0

我已经在 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');  

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

4

0 回答 0