Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Nielson's avatar
Level 14

Sending mail through One.com mail server with Laravel?

Hi guys,

I'm trying to send a mail through a One.com email address, but I get the following error:

Expected response code 220 but got code "521", with message "521 Connection was rejected
↵

I have filled in the following:

MAIL_DRIVER="smtp"
MAIL_HOST="mailout.one.com"
MAIL_PORT=587
MAIL_USERNAME="MAIL ADDRESS"
MAIL_PASSWORD="PASSWORD"
MAIL_ENCRYPTION=null

It works fine when testing with Mailtrap, so nothing wrong with the code.

I'm testing locally, but in production which is hosted on Digital Ocean, I get the same error.

I've tried the the different ports that One.com recommends at https://help.one.com/hc/en-us/articles/115005594345-Can-I-send-mails-from-my-website-.

I haven't contacted their support yet, but hoped that someone here has experienced the same? :)

0 likes
4 replies
arthvrian's avatar

you miss this

Port and encryption:
- 587 with STARTTLS (recommended)
- 465 with TLS
- 25 with STARTTLS or none

you must set MAIL_ENCRYPTION (if you use the 587 port) to ssl (or tls if still not working) or use port 25 with MAIL_ENCRYPTION=null

1 like
Nielson's avatar
Level 14

@ARTHVRIAN - Thanks for the reply, Arthvrian!

With SSL on port 587 I get the error:

Connection could not be established with host mailout.one.com [ #0]

And with TLS I get the error:

Expected response code 220 but got code \"521\", with message \"521 Connection was rejected\r\n\"

If I use port 25 and encryption = NULL, I get a timeout error.

With port 465 with both SSL and TLS, I also get a timeout error.

I changed the password as well to be sure that I didn't have that wrong :/

Nielson's avatar
Level 14

@ARTHVRIAN - Thanks! Can't believe why I didn't find that sooner!

It works perfectly now :)

Please or to participate in this conversation.