【发布时间】:2019-05-23 09:54:53
【问题描述】:
我想使用 phpMailer 发送短信,我尝试进行所有配置但收到消息
警告:mail():SMTP 服务器响应:550 访问被拒绝 - 无效 C:\xampp\htdocs
中的 HELO 名称(参见 RFC2821 4.1.1.1)
下面是我的代码
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'vendor/autoload.php';
$mail = new PHPMailer(true);
try{
$mail->isSMTP();
$mail->Host = 'mail.ku..e.com';
$mail->SMTPAuth = true;
$mail->Username = 'info@ku..e.com';
$mail->Password = 'my password';
$mail->SMTPSecure = 'tls';
$mail->Port = 25;
//$mail->Port = 25;
$to = "+25078.....@vtext.com";
$from = "info@k..e.com";
$message = "aaaaa";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'From: Your name <info@ku..e.com>' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($to, '', $message, $headers);
} catch (Exception $e){
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
}
我是这样配置php.ini的
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = mail.ku..e.com
; http://php.net/smtp-port
smtp_port=25
; For Win32 only.
; http://php.net/sendmail-from
;username = info@ku..e.com
;password = my password
;sendmail_from = info@ku..e.com
我使用 Inmotion 托管
请任何人都可以帮助我使用上述代码发送短信
【问题讨论】:
-
因“550 Access denied”错误而在邮件客户端中禁用 SMTP 身份验证并检查端口