Why can't I send emails from SMTP while using PHP?

I can't send emails from SMTP while using PHP, and I'm getting the following error message:

220-We do not authorize the use of this system to transport unsolicited,
220 and/or bulk e-mail

Does anyone know what the issue could be?

5 Replies

I did some digging on this, and found that there could be a couple things affecting your ability to send mail using PHP.

Via Stack Overflow, it looks like someone was able to fix this in their configuration file by switching from port 25 to port 587:

SMTP Error(220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.)

You also might want to double check to make sure you have an SPF record configured. The SPF record is basically a txt record in your DNS that authorizes the domain to send mail from a particular server.

I found an SPF record generator that's pretty easy to use:

https://mxtoolbox.com/SPFRecordGenerator.aspx

Also, here's a link to one of our other Community site posts that shows how to add the SPF record once it's been created:

How do I add an SPF record for my domain?

Hopefully this points you in the right direction. Let us know what you find!

We have set SPF records as below

v=spf1 a mx a:domain ~all

but still having same issue of emails are not getting send.

And getting below error

SMTP -> ERROR: Failed to connect to server: Connection refused (111)SMTP Connect() failed.

Did you try switching from port 22 to port 587, too, from the post that John mentioned?

If so, you could check from your local machine to confirm your port is open using nmap. You should see something like this:

nmap -p587 <your_linode_IP>
...
PORT    STATE  SERVICE
587/tcp open   submission

This response from server

Starting Nmap 6.40 ( http://nmap.org ) at 2019-08-22 05:36 UTC
Nmap scan report for li280-63.members.linode.com (linode_ip)
Host is up (0.000053s latency).
PORT    STATE SERVICE
587/tcp open  submission

Nmap done: 1 IP address (1 host up) scanned in 0.29 seconds

and we have also used 587 port

Now getting below error

SMTP -> FROM SERVER:220 itapp2u.com ESMTP Postfix (Ubuntu) CLIENT -> SMTP: EHLO 173.255.254.63 SMTP -> FROM SERVER: 250-itapp2u.com 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-STARTTLS 250-AUTH DIGEST-MD5 CRAM-MD5 NTLM PLAIN LOGIN 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN CLIENT -> SMTP: AUTH LOGIN CLIENT -> SMTP: bGlub2RlQGl0YXBwMnUuY29t CLIENT -> SMTP: QWRtaW5AMjAxOQ== SMTP -> ERROR: Password not accepted from server: 535 5.7.8 Error: authentication failed: authentication failure CLIENT -> SMTP: quit SMTP -> FROM SERVER:221 2.0.0 Bye SMTP Connect() failed. Message not Sent!

Hmm… In looking at the specific error message you posted it does look similar to what was posted on this Stack Overflow thread:

https://stackoverflow.com/questions/14297264/password-not-accepted-from-server-535-incorrect-authentication-data-when-send

There are a few suggestions posted there that seem to have resolved this for a few people.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct