0

I am currently working on sending e-mail in PHP directly with stream_socket_client().

This is working pretty well so far. I am able to send HTML e-mail with a DKIM signature that passes all the tests on https://www.mail-tester.com

Mail is being received by my own mail server as well as Yahoo and AOL with no delivery or spam issues.

But when I send to Gmail not only does the e-mail not arrive, but no delivery report is sent back to the return path. This is despite no errors being given during the SMTP exchange.

If I send the exact same test e-mail to Gmail using mail() it arrives no problem. I have compared the source of both e-mails and they only differ slightly on the DKIM signature, I have no "x" header and the encrypted headers list is different. I don't think that is the issue though.

The only difference I can see between what I am doing and mail() is that I'm not using TLS yet. This would appear to be a strong candidate, but from what I have read Gmail doesn't make TLS a requirement for receiving e-mail.

Is there something else I may be missing?

Below is the SMTP exchange:

SMTP Connection:

HOST: 220 mx.google.com ESMTP f128si20492958wme.149 - gsmtp

EHLO: 250-mx.google.com at your service, [90.100.136.100]

FROM: 250-SIZE 157286400

RCPT: 250-8BITMIME

DATA: 250-ENHANCEDSTATUSCODES

DATA WRITE: 250-PIPELINING

QUIT: 250-CHUNKING
Kline
  • 227
  • 4
  • 13
  • gmail shows if the sending server was using TLS if you click on the little arrow next to recipents – jaskij May 13 '20 at 22:12

1 Answers1

0

The problem was in way the opposite, Gmail was being strict on all line endings, whilst the other services were not.

I found a rouge extra line ending which was causing the communication to fail at FROM.

The various codes above were infact a multi-line response from the EHLO call, I then had I mistook those line for responses to subsequent calls.

Kline
  • 227
  • 4
  • 13