Question

SMTP is not working with DO app

I have Laravel application having SMTP configuration setup. I was using Microsoft 365 for it but it got same fail. Then switched to sendGrid but it also got fail. This is the error I am getting: Expected response code “250” but got code “550”, with message “550 5.7.1 Sending from domain o1.eu is not allowed”.

Below are my env file details:

MAIL_MAILER=smtp
MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=587
MAIL_USERNAME=apikey
MAIL_PASSWORD=my_api_key
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=customer_invoices@o1.eu
MAIL_FROM_NAME="Laravel - DEV"

Please guide me how I can get my SMTP to work.

We’ve used different options, but nothing really worked out. Any idea what we’re doing wrong?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

KFSys
Site Moderator
Site Moderator badge
March 12, 2025

Heya,

The issue is not coming from your Laravel Application or DigitalOcean. You need to allow the domain you’ll send messages from on your mail provider.

Bobby Iliev
Site Moderator
Site Moderator badge
March 12, 2025

Hey Ondrej 👋

The error 550 5.7.1 Sending from domain o1.eu is not allowed usually means your from address domain (o1.eu) isn’t properly authenticated. Even though you switched providers, you still need to verify and set up SPF, DKIM, and possibly DMARC records for o1.eu in your DNS settings.

I think that you should be able to do that by:

  • Log into SendGrid → Settings → Sender Authentication → Add your domain (o1.eu) → Follow the DNS setup instructions.

Once that’s done, SendGrid will allow you to send emails from that domain without hitting the 550 error.

- Bobby

I am facing the same problem. Some of my Laravel Projects are hosted on different droplets across different accounts and all the droplets are failing to send emails using my smtp mailers. I have used same mailers on the apps deployed on Microsoft Azure and thay are working fine there.

Failed to send test email. Detailed error: Connection could not be established with host “smtp.mailersend.net:587”: stream_socket_client(): Unable to connect to smtp.mailersend.net:587 (Connection timed out) #0 [internal function]: Symfony\Component\Mailer\Transport\Smtp\Stream\SocketStream->{closure:Symfony\Component\Mailer\Transport\Smtp\Stream\SocketStream::initialize():153}()`

Few Days Ago this was working perfectly fine but now all of the sudden it just stopped.

Even tried Gmail’s SMTP Server openssl s_client -connect smtp.gmail.com:587 -starttls smtp Still same issue.

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.