通过hMailServer发送邮件无法在WAMP

时间:2016-03-21 09:12:17

标签: php email smtp wamp hmail-server

我在stackoverflow和其他互联网上搜索过这个问题,但我找不到合适的答案。所以这个问题没有重复。

我正在使用hMailServer通过WAMP发送邮件,但它根本无法正常工作。我完全正确地配置了hMailServer和PHP.ini文件,通过gmail服务器发送电子邮件,使用这段代码:

<?php
ini_set("SMTP", "smtp.gmail.com");
ini_set("smtp_port", 465);

$msg = "First line of text\nSecond line of text";
$msg = wordwrap($msg,70);
mail("design.clearmotion@gmail.com","My subject",$msg);
?>

在hMailServer中我使用这些设置:

Local host name: Localhost
Remote host name: smtp.gmail.com
IP port: 465
User name: design.clearmotion@gmail.com
Password: [password for my email]
Connection security: SSL/TLS

我不知道我做错了什么,因为它给了我这个错误:

Warning: mail(): Failed to connect to mailserver at &quot;smtp.gmail.com&quot; port 465, verify your &quot;SMTP&quot; and &quot;smtp_port&quot;

更新: 使用此链接:http://blog.techwheels.net/send-email-from-localhost-wamp-server-using-sendmail/,现在又出现了另一个错误:

 Warning: mail(): SMTP server response: 550 The address is not valid.

当我将其添加到代码顶部时:

ini_set("SMTP","ssl:smtp.gmail.com" );
ini_set("smtp_port","465");
ini_set('sendmail_from', 'design.clearmotion@gmail.com');  

它给出了与开头提到的相同的错误。

0 个答案:

没有答案
相关问题