naykel's avatar

error Expected response code "250" but got code "550", with message "550 Error458 block"

I am getting an error Expected response code "250" but got code "550", with message "550 Error458 block" when attempting to send an email. If I understand this error suggests that the email was blocked by the recipient's email server or filtering system.

The error is coming from the 'from' address in my mail class (which should be the users email in a contact form). I have confirmed this by commenting out the 'from' address and the error goes away but the reply address in wrong.

public function envelope(): Envelope
{
    return new Envelope(
        subject: 'Message Received',
        // comment out to prevent error
        from: new Address($this->enquiry['email'], $this->enquiry['name'])
    );
}

What leaves me scratching my head is that this only happens with one particular domain.

Can anyone suggest what may be causing the problem and how I can fix it.

0 likes
5 replies
LaryAI's avatar
Level 58

The error message suggests that the recipient's email server or filtering system has blocked the email. This could be due to various reasons such as the sender's IP address being blacklisted, the email content triggering spam filters, or the recipient's email server having strict security policies.

To fix the issue, you can try the following:

  1. Check if the sender's IP address is blacklisted by using a tool such as MXToolbox. If it is, contact the blacklist provider to request removal.

  2. Make sure the email content does not trigger spam filters. Avoid using spammy words, excessive capitalization, and too many links.

  3. Contact the recipient's email server administrator to inquire about their security policies and see if they can whitelist your email address or domain.

  4. Use a reputable email service provider such as SendGrid or Mailgun that has good deliverability rates and provides tools to help avoid spam filters.

Regarding the specific code issue, it is possible that the recipient's email server is blocking emails with a "from" address that does not match the sender's domain. You can try setting the "reply-to" address instead of the "from" address to avoid this issue. Here's an example:

public function envelope(): Envelope
{
    return new Envelope(
        subject: 'Message Received',
        from: new Address('[email protected]', 'Your Name'),
        replyTo: new Address($this->enquiry['email'], $this->enquiry['name'])
    );
}
Snapey's avatar
Snapey
Best Answer
Level 122

you can probably only send 'From' a domain for which there is an account on the server. Mail servers generally don't allow you to pick your own from address

The mail server and domain DNS records need an SPF record saying that the mail server is allowed to send for the domain - otherwise your email just ends up in spam.

naykel's avatar

Thanks @Snapey that explains why the sites I host work and the others don't. I will check out and add the SPF record as you suggested.

eduar's avatar

@naykel Hola, como estas, una pregunta, pudiste solucionar el error? por alguna razon a mi tambien me da ese error usando laravel, gracias

naykel's avatar

@eduar I memory serves correctly my error was caused because the email I was trying to send from was not on my server like Snapey suggest above.

Please or to participate in this conversation.