开发者

SMTP server response: 550 - currently not permitted to relay 550-through this server

I am using php mail() to send email, via SMTP But when i send mail from example@example.com, I am getting below error,

开发者_C百科

Warning: mail() [function.mail]: SMTP server response: 550-(ABC-7d3b78ff) [117.98.220.45]:1747 is currently not permitted to relay 550-through this server. Perhaps you have not logged into the pop/imap server 550-in the last 30 minutes or do not have SMTP Authentication turned on in your 550 email client.

Is this issue with my code or should i need to change on server side?

Here is my code :

$header .= "\r\nMIME-Version: 1.0";
$header .= "\r\nContent-type: text/html; charset=iso-8859-1\r\n";

$from    = $row["fromid"];
$to      = $row["email_addr"]; // abc@yahoo.com sending to other than same domain mail
$subject = $row["subject"];

mail($to,$subject,$body,$header);


It looks like PHP on your server is configured to speak to an SMTP server when using mail(). That error message indicates that your SMTP server expects you to either perform direct authentication, or for you to perform a POP-before-SMTP authentication. If you are on shared hosting, I commend your web hosting provider for being so clever.

As mentioned in the comments SwiftMailer is a powerful, easy to use mailing library that includes the ability to perform SMTP authentication. Some people also recommend PHPMailer or PEAR's Mail, both of which are also able to perform SMTP auth.


This problem can be solved, by simply adding the follwing line in your php:

    ini_set(sendmail_from,'yourmail@abc.com');

Thus your code will become:

    $header .= "\r\nMIME-Version: 1.0";
    $header .= "\r\nContent-type: text/html; charset=iso-8859-1\r\n";

    $from    = $row["fromid"];
    $to      = $row["email_addr"]; // abc@yahoo.com sending to other than same domain mail
    $subject = $row["subject"];

    ini_set(sendmail_from,'yourmail@abc.com');
    mail($to,$subject,$body,$header);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜