SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output $mail->isSMTP(); //Send using SMTP $mail->Host = 'mail.bpitattendance.online'; //Set the SMTP server to send through $mail->SMTPAuth = true; //Enable SMTP authentication $mail->Username = 'junet@bpitattendance.online'; //SMTP username $mail->Password = 'root'; //SMTP password $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption $mail->Port = 465; //Sender if( $sender_name == ''){ $mail->setFrom($sender_email); } else{ $mail->setFrom($sender_email,$sender_name); } //Receiver if( $receiver_name == '' ){ $mail->addAddress($receiver_email); } else{ $mail->addAddress($receiver_email,$receiver_name); } //Reply to if( $replyTo_email != '' ){ if( $replyTo_name == '' ){ $mail->addReplyTo($replyTo_email); } else{ $mail->addReplyTo($replyTo_email,$replyTo_name); } } //Attachments if( $attachments != null ){ $sz = count($attachments); $n_ele; for( $idx = 0 ; $idx < $sz ; $idx++ ){ $n_ele = count($attachment[$idx]); if( $n_ele == 1 ){ $mail->addAttachment($attachment[$idx][0]); } else{ $mail->addAttachment($attachment[$idx][0],$attachment[$idx][1]); } } } //Recipients // $mail->addCC('cc@example.com'); // $mail->addBCC('bcc@example.com'); //Content $mail->isHTML(true); //Set email format to HTML //File stream reading.. $fSContent = fopen($subFilename,'a+'); $fBContent = fopen($bodyFilename,'a+'); $fABContent = fopen($altBodyFilename,'a+'); $mail->Subject = getSubject($fSContent,$subFilename); $htmlBody = getBody($fBContent,$bodyFilename); $mail->Body = $htmlBody; $nonHtmlBody = getBody($fABContent,$altBodyFilename); $mail->AltBody = $nonHtmlBody; fclose($fSContent); fclose($fBContent); fclose($fABContent); $mail->send(); echo 'Message has been sent'; } catch (Exception $e) { echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; } } ?>