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

12,153

Solution 1

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.

Solution 2

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

    ini_set(sendmail_from,'[email protected]');

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"]; // [email protected] sending to other than same domain mail
    $subject = $row["subject"];

    ini_set(sendmail_from,'[email protected]');
    mail($to,$subject,$body,$header);
Share:
12,153
MMT
Author by

MMT

Updated on June 05, 2022

Comments

  • MMT
    MMT almost 2 years

    I am using php mail() to send email, via SMTP But when i send mail from [email protected], I am getting below error,

    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"]; // [email protected] sending to other than same domain mail
    $subject = $row["subject"];
    
    mail($to,$subject,$body,$header);