我有以下代码来发送电子邮件:
$mail->IsSMTP();
$mail->Host = 'imap.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'my gmail id';
$mail->Password = 'mypassword';
$mail->SetFrom('info@somedomain.com', '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
任何形式的帮助表示赞赏