2013-03-22 53 views
0

发送电子邮件,我有以下的代码来发送电子邮件:PHP邮件,Gmail的SMTP不活的服务器

$mail->IsSMTP(); 
     $mail->Host = 'imap.gmail.com'; 
     $mail->SMTPAuth = true; 
     $mail->Username = 'my gmail id'; 
     $mail->Password = 'mypassword'; 
     $mail->SetFrom('[email protected]', 'Bilafon'); 
     $mail->Subject = $subject; 
     $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; 
     $mail->MsgHTML($body); 
     $mail->AddAddress($email_id, $user_name); 
     return $mail->Send(); 

其从本地主机而不是从活的服务器发送电子邮件。直播服务器时,它显示了这个错误:

SMTP Error: Could not authenticate 

任何形式的帮助表示赞赏

回答

1

检查您的Gmail设置。从那里可能会禁用SMTP。

相关问题