2015-07-19 10:50
浏览 492


I'm trying to send E-Mails over SMTP using the PHPMailer library I just downloaded from GitHub. I followed a tutorial but it doesn't want to send its E-Mail.

My HTTPD error log returns the following entry:

[Sun Jul 19 12:44:08.067906 2015] [proxy_fcgi:error] [pid 12127:tid 140673456404224] [client -] AH01071: Got error 'PHP message: PHP Notice: Undefined index: mailtest.php in /home/mick/domains/mcgamerzone.com/public_html/header.php on line 56 PHP message: PHP Fatal error: Class 'SMTP' not found in /home/mick/domains/mcgamerzone.com/public_html/assets/sources/PHPMailer-master/class.phpmailer.php on line 1291 ', referer: https://www.mcgamerzone.com/mailtest.php

My code is as follows:

$mail = new PHPMailer();
$mail->SMTPDebug = 1;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "tsl";
$mail->Host = "mail.mcgamerzone.com";
$mail->Port = 25;
$mail->Username = "do_not_reply@mcgamerzone.com";
$mail->Password = "Pass";
$mail->From = "do_not_reply@mcgamerzone.com";
$mail->FromName = "McGamerZone.com";
$mail->Subject = "Test mail";
$mail->Body = "Testing this awesome mail";
    echo "Mailer Error: ". $mail->ErrorInfo;
} else {
    echo "Message was send.";

Please help me resolve this issue, thanks.

Edit: I now get the following output:

2015-07-19 11:05:24 CLIENT -> SERVER: EHLO www.mcgamerzone.com 2015-07-19 11:05:24 CLIENT -> SERVER: STARTTLS 2015-07-19 11:05:24 SMTP Error: Could not connect to SMTP host. 2015-07-19 11:05:24 CLIENT -> SERVER: QUIT 2015-07-19 11:05:25 SMTP ERROR: QUIT command failed: ���~�#������Y�� d�h;�ѵK��
u���ZVۯ�<@{���=h�0���Zt��m?�R�j��7����M����U�9Kzշж�"����4��ƺ,��'�j࠹ė���1p��6�(a0�����A]�0'�s��1��s�ՠt�}�� Hm��:�D2��1]u���A��͆���������(���!r�.�#���cɵ=�K� )��s�k�u�~�c���qϝ�8Nq� ����O�@2�O-����\���Pl޾{����t�j���㦂JN���ݒ�J��s�wR�}�|b �R�^���j��vi�J��''Z�4���b�RɊ�G"�� ��T�t͵�ƲPq|����4���R�E��4Vn0%��0��w�o�[��(����
�7�����љc���c�w��j�_/���9��@��Vj���l�������i��r��j��{Zq��L����y��*pe�����+���;b����&A7T�@>x�\��C�W����Iw&L_4b�q�(���A��:/}��\l����$��,�y}�\�?&F��y���=eP�3�Q�&Z�,����k���(̛m~Ç_��S�o �-"����@�����a���r��^&�\23 ���l]J&�^�#n�w�Q�BJ����>��rwG�� LÂ�zo۸�G7��e-��d�q cvV$�Sn�o�V��r ��m��k{�D�d��B)\ +��nN��w��%A ?��������b`0s�����0����9��M��� ##�����B���Xi�+C���;3m�q��/>?��n��k��� ����T�t��hD�W'>����8��w�ܶԪ(��&ɻ�?8Ȋ�221 mgz05.mgzsys.net closing connection 2015-07-19 11:05:25 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

Any idea why the connection fails? Both the credentials as the host info and encryption type are valid.

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dougou2937 2015-07-19 10:56

    I suspect you are doing this:

    require 'class.phpmailer.class.php';
    $mail = new PHPMailer;

    What you should be doing is:

    require 'PHPMailerAutoload.php';
    $mail = new PHPMailer;

    The autoloader does not autoload itself, and it's not the PHPMailer class' job to load it.

    (source: https://github.com/PHPMailer/PHPMailer/issues/113 )

    打赏 评论

相关推荐 更多相似问题