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