PHPmailer do not send email and do not give any error just give a blank page on but same code running on localhost. Please help me

For some days i am trying to send email by using phpmailer which is correctly working on localhost but when i upload same project on the server email not send and also no errors return. this is happening on

But i have another server with the name inovexi when i upload on this server then email send.

i don't know what is matter actually behind this seen. Please guide me. Thanks.

i have used phpmailer in many projects before. I also have used swiftmailer as well.

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'vendor/autoload.php';

$mail = new PHPMailer(true);
try {
    $mail->SMTPDebug = 3;
    $mail->Host       = '';
    $mail->SMTPAuth   =  true;
    $mail->Username   = '';
    $mail->Password   = 'AB11223344';
    $mail->SMTPSecure = 'tls';
    $mail->Port       =  587;

    $mail->setFrom("", "Artizan");
    $mail->addAddress('', "Artizan");
    $mail->addReplyTo('', 'reply-artizan');

    $mail->Subject = "Artizan Contact Email";
    $mail->Body    = "This is test message";
    $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

catch (Exception $e) 
    echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";

1 answer

  • answered 2019-09-11 11:56 kbj

    I have no precise answer for you right now mate, but I do have a bit of advice to help you get there.

    A blank page often means a HTTP 500 error, but you can't see it because of PHP configuration on the server.

    Do you have access to any logs on this server ? Do you have a way to enable warning, error and exception display on this server ?

    You probably can get something out of this exception, but 'echoing' it is not the proper way to handle it.

    Use a logger if you can, or create a log table in your database, anything that would be convenient and doable for you.