2011-12-29 9 views
0

Gmailを使用してメールを送信するのにこのコードを使用しましたが、以下のエラーが表示されます。ここではsslの部分を削除しましたが、動作しています。その他の問題?SMTP GmailサーバーSSLエラー

$mail = new phpmailer; 
$mail->IsSMTP(); // telling the class to use SMTP 
$mail->SMTPDebug = 1;// enables SMTP debug information (for testing) 
$mail->SMTPAuth = true; // enable SMTP authentication 
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier 
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server 
$mail->Port = 465; // set the SMTP port for the GMAIL server 
$mail->Username = "un"; // GMAIL username 
$mail->Password = "pwd"; // GMAIL password 
$mail->SetFrom('[email protected]', 'Bharanidharan'); 
$mail->AddReplyTo("[email protected]","Vishal Kumar"); 
$mail->AddAddress("[email protected]","Bharani"); 
$mail->Subject = "Hey, check out"; 
$body = "hey, check email"; 
$mail->MsgHTML($body); 
$address = "[email protected]"; 
$mail->AddAddress($address, "test"); 
if(!$mail->Send()) 
{ 
echo "Mailer Error: " . $mail->ErrorInfo; 
} 
else 
{ 
echo "Message has been sent"; 
} 
+1

どこ実際のエラーメッセージがある(php.iniのを確認してください)Apacheの中のmod_ssl(設定ファイルを検索)とOpenSSLのPHP拡張モジュールを有効にしますか? –

+0

SMTP - > ERROR:サーバへの接続に失敗しました:ソケット転送 "ssl"を見つけることができません - PHPを設定したときに有効にするのを忘れましたか? (72165504) SMTPエラー:SMTPホストに接続できませんでした。メーラーエラー:SMTPエラー:SMTPホストに接続できませんでした。 – DON

答えて

関連する問題