imap - PHP Mailer : MAIL not accepted from server.The following From address failed -
i'm having issues sending mil using php mailer. have tried 2 different mail servers. 1 of these mail servers have access through local ip well. when use local ip value $server variable, things work fine , mails go through. when use external ip mail server things don't work , error shown below. same case while using mail server's dns. exact same error both times.
$mail = new phpmailer; $server = 'mail.xxxx.com'; $smtpport = '25'; $username = 'xxxx@xxxx.com'; $password = 'xxxxx'; $mail->issmtp(); // set mailer use smtp $mail->host = $server; // specify main , backup server $mail->smtpauth = true; // enable smtp authentication $mail->username = $username; // smtp username $mail->password = $password; // smtp password $mail->from = 'xxxx@xxxxxx.com'; $mail->addaddress('abijeet@xxxxx.asia', 'xxxxx'); // add recipient $mail->wordwrap = 50; // set word wrap 50 characters $mail->ishtml(true); // set email format html $mail->subject = 'here subject'; $mail->body = 'this html message body <b>in bold!</b>'; if(!$mail->send()) { echo 'message not sent.'; echo 'mailer error: ' . $mail->errorinfo; exit; } echo 'message has been sent'; this debug output phpmailer both servers when external ip or dns used-
smtp -> server:220 mail.xxxxxx.com esmtp postfix smtp -> server: 250-mail.xxxxxx.com 250-pipelining 250-size 15728640 250-vrfy 250-etrn 250-starttls 250-auth login plain 250-auth=login plain 250-enhancedstatuscodes 250-8bitmime 250 dsn smtp -> server: smtp -> error: mail not accepted server: message not sent.mailer error: following address failed: xxx@xxxxxx.comsmtp server error: smtp -> server:220 xxxxx.com esmtp citadel server ready. smtp -> server: 250-hello localhost (xxx.xxxxx.net [xxx.xxx.xxx.xxx]) 250-help 250-size 10485760 250-auth login plain 250-auth=login plain 250 8bitmime smtp -> server: smtp -> error: mail not accepted server: message not sent.mailer error: following address failed: abijeet@xxxx.comsmtp server error: also note able connect dns based mail server using windows live mail, it's not port issue.
if connect external ip address, external source address, , suspect it's dynamic address in case. well-configured email servers not allow random external ip addresses send mail through them.
the solution use either smtp authentication or internal address.
Comments
Post a Comment