1

PHP SMTPメール機能がphpmailerで動作せず、次のエラーがスローされる

エラー: SMTP エラー: 言語文字列の読み込みに失敗しました: tls.

私のコードは:

require_once('class.phpmailer.php');

$mail  = new PHPMailer();   
$mail->IsSMTP();    
$mail->SMTPAuth   = True;                  // enable SMTP authentication
$mail->SMTPSecure = "tls";                 // sets the prefix to the server
$mail->Host       = "localhost";      
$mail->Port       = 25;                 
$mail->Username   = "xxxxxx@xxxxx.org.in";  // my username
$mail->Password   = "xxxx";            // my password

$mail->From       = "xxxxxxx@xxxxx.org.in";
$mail->FromName   = "you name";
$mail->Subject    = "some subject";
$mail->MsgHTML("the message");

$mail->AddAddress("yyyyyy@gmail.com","logan");
$mail->IsHTML(true); // send as HTML

if(!$mail->Send()) {//to see if we return a message or a value bolean
    echo "Mailer Error: " . $mail->ErrorInfo;
} else  echo "Message sent!";

Web サービス プロバイダーのホストとポートの詳細を取得しましたが、機能していません。

デバッグすると、次のエラーが表示されます。

SMTP -> FROM SERVER:220 We do not authorize the use of this system to transport unsolicited, and/or bulk e-mail.
SMTP -> FROM SERVER: 250-mail02.clientns.net [127.0.0.1], this server offers 4 extensions 250-AUTH LOGIN 250-SIZE 52428800 250-HELP 250 AUTH=LOGIN
SMTP -> FROM SERVER:503 Bad sequence of commands
SMTP -> ERROR: STARTTLS not accepted from server: 503 Bad sequence of commands
SMTP -> FROM SERVER:250 Requested mail action okay, completed
Language string failed to load: tls Mailer Error: Language string failed to load: tls

接続できない理由を教えてください。

4

2 に答える 2

11

以下を削除するとうまくいきました..

//$mail->SMTPSecure = "tls";
于 2013-01-13T17:47:50.593 に答える
1

サーバーでホストされているセキュリティで保護されたメールサービスを使用するようにPHPMaillerに指示します。それが当てはまるかどうかわからない場合は、このように行にコメントを付けてテストします(ここで説明するように、phpネイティブの「mail()」関数を使用します)。

require_once('class.phpmailer.php');

$mail  = new PHPMailer();   
//$mail->IsSMTP();    
//$mail->SMTPAuth   = false;                  // enable SMTP authentication
//$mail->SMTPSecure = "ssl";                 // sets the prefix to the server
//$mail->Host       = "localhost";      
//$mail->Port       = 25;                 
//$mail->Username   = "xxxxxx@xxxxx.org.in";  // my username
//$mail->Password   = "xxxx";            // my password

$mail->From       = "xxxxxxx@xxxxx.org.in";
$mail->FromName   = "you name";
$mail->Subject    = "some subject";
$mail->MsgHTML("the message");

$mail->AddAddress("yyyyyy@gmail.com","logan");
$mail->IsHTML(true); // send as HTML

if(!$mail->Send()) {//to see if we return a message or a value bolean
    echo "Mailer Error: " . $mail->ErrorInfo;
} else  echo "Message sent!";
于 2013-01-13T17:08:42.640 に答える