質問

私の古い構成をほとんど台無しにしたXAMPPの最新のアップデートをダウンロードしました。ある時点で、PHPでBasic Mail()を送信することができましたが、更新すると停止しました。

私は少し調査し、誰もがZendまたはPhpMailerを推奨しました。私はphpmailerを試してみましたが、coundが応答を得られないというエラーを返しました。

私のphp.iniをいじり、ソケットのタイムアウトを60から120に増やしました。それはうまくいかなかったので、テストメールを自分に送信してみました。

Failed to connect to mailserver at "localhost" port 25,
verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()

それで、私はphp.iniをチェックしました

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25;

;Add X-PHP-Originating-Script: that will 
;include uid of the script followed by the filename

わかりましたので、「phpmailerを使用してSMTPとポートを含めるだけです。

require_once('../class.phpmailer.php');

$mail             = new PHPMailer();        // defaults to using php "mail()";

$body             = file_get_contents('contents.html');
$body             = eregi_replace("[\]",'',$body);

$mail->IsSMTP();                            // telling the class to use SMTP
$mail->AddReplyTo("noreply@randomcompany.com","Company Name Here");
$mail->Host       = "localhost";           // SMTP server
$mail->SMTPDebug  = 2;                      // enables SMTP debug information (for testing)
$mail->Port       = 25;                     // set the SMTP port for the GMAIL server


$mail->From       = "noreply@randomcompany.com";
$mail->FromName   = "Company Name Here";

$address = "test@yahoo.com";
$mail->AddAddress($address, "Hello to myself for testing!");

$mail->Subject    = "PHPMailer Test Subject via mail(), basic";

$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test

$mail->MsgHTML($body);

//$mail->AddAttachment("images/phpmailer.gif");      // attachment
//$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment

if(!$mail->Send()) {
  echo "Mailer Error: " . $mail->ErrorInfo;
} else {
  echo "Message sent!";
}

mail.add_x_header = Off 

言った:

SMTP -> ERROR: Failed to connect to server: 
A connection attempt failed because the connected 
party did not properly respond after a period of 
time, or established connection failed because 
connected host has failed to respond. (10060)

SMTP Error: Could not connect to SMTP host. 
Mailer Error: SMTP Error: Could not connect to SMTP host.

水星は言った:

This message is sending now ...

Error! The message was not successfully sent!

Zurück zum Formular

そのすべての時間を費やしました、そして私は今疑問に思っています、それは私のコード、php.ini、phpmailer、またはyahooですか?

役に立ちましたか?

解決

MailServerが足りないと思います。それとも、ポート25で実行されているローカルメールサーバーはありますか? ;-)しかし、XAMPPは郵便配達員に名前が付けられています Mercury - だから...それを始めて楽しんでください;-)。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top