linux - SMTP服务器拒绝PHP函数发送邮件的问题?
1 2 | <code>SMTP server error: 5.7.1 <********@qq.com>: Relay access denied
</code>
|
登陆服务器用mail -s "test" *****@qq.com 测试过smtp服务器是可以发送邮件的。为什么用PHP写的函数就被拒绝了呢?这段函数以前是起作用的,而且丝毫没动过。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | <code> public function SendMail( $address , $title , $message ) {
vendor( 'PHPMailer.class#phpmailer' );
$mail = new PHPMailer();
$mail ->IsSMTP();
$mail ->ishtml(true);
$mail ->CharSet= 'UTF-8' ;
$mail ->AddAddress( $address );
$mail ->Body= $message ;
$mail ->From=C( 'MAIL_ADDRESS' );
$mail ->FromName=C( 'MAIL_SENDER' );
$mail ->Subject= $title ;
$mail ->Host=C( 'MAIL_SMTP' );
$mail ->SMTPAuth=true;
$mail ->Username=C( 'MAIL_LOGINNAME' );
$mail ->Password=C( 'MAIL_PASSWORD' );
$mail ->Send();
return $mail ;
}
</code>
|