Reputation: 317
In the context of writing an MSA (of sorts) for our application I'm currently writing some code to test if it is possible to connect to a given address to send mail, including if authentication is required.
To test for the latter I pretend to be sending an email from the (fictional) address with the same address used for the recipient.
I use this approach, although I'd rather not have to, since I need to be able to send both a MAIL verb and an RCPT verb to the server. The reason for this is, as far as I can tell, no verb prior to sending MAIL (i.e. EHLO, STARTTLS, AUTH etc.) will elicit an error if authentication is missing. Some servers, such as Gmail, respond with an error on sending an unauthorized MAIL, but others only react once I try to add a recipient, hence the need for both verbs.
The reason I use an IP address instead of a domain name in the fictional mail is that I do not necessarily have access to a domain name at that point. I know it isn't pretty, but it is legal. Provided the IP address is specified according to RFC 5321.
The funny thing is that Gmail will accept the MAIL verb using the fictional mail address, but will throw a 553 error when the same address is used for the recipient complaining it isn't a valid RFC 5321 address.
SEND: "MAIL FROM:<test@[IPv6:fe80::105e:c040:c56c:b8bc]>"
RECV: "250 2.1.0 OK s82sm4688131lja.26 - gsmtp"
SEND: "RCPT TO:<test@[IPv6:fe80::105e:c040:c56c:b8bc]>"
RECV: "553-5.1.2 The recipient address <test@[ipv6:fe80::105e:c040:c56c:b8bc]> is not a"
"553 5.1.2 valid RFC-5321 address. s82sm4688131lja.26 - gsmtp"
I should note that I've tried this both with and without the IPv6 prefix. Without it, another SMTP server running on Postfix complains. The Postfix-based server is coincidentally one of those not throwing an error when sending the MAIL verb unauthenticated.
This issue with Gmail isn't limited to IPv6 addresses, by the way. Switching to an IPv4 address produces the same result. Neither does the issue seem to be linked to local addresses. The MAIL verb is accepted, the RCPT verb fails.
As far as I can tell what I provide is a proper RFC 5321 compliant address. What's going on? Where do I go wrong? At first glance the problem seems to be with GMail/GSMTP.
Upvotes: 2
Views: 28195
Reputation: 1
Even though the question is old, I'm answering in case someone has the same problem. Using thunderbird, to send an email to [email protected], I had the same error as you, but by going directly to the gmail.com website, I was able to send my email normally. You can test on your side if you have this type of error.
Cordially Christopher
Upvotes: 0
Reputation: 118425
Well, yes, it is a "problem" with Gmail/SMTP in a loose sense of the word; a "problem" in the sense that they refuse to accept email addressed to an address-literal
, as specified in RFC 5321.
Even though RFC 5321 allows an address literal in the RCPT TO
, Gmail obviously chose not to support it, for whatever reasons they used. I'm confident that Gmail is not the only mail provider in the world that, for one reason or another, does not support some arcane part of the SMTP protocol.
And that's pretty much it. The answer here is, pretty much, "it is what it is". The command you're sending is compliant with RFC 5321. Gmail rejects it. The End.
If you want to be pedantic about this, section 3.3 of RFC 5321 also states:
Similarly, servers MAY decline to accept mail that is destined for other hosts or systems.
So, pedantically, Gmail's mail servers are not technically required to accept mail for anyone else other than Gmail. So that's that.
Your options are:
Don't use address literals.
Use another mail server provider that supports destination addresses specified as address literals.
Upvotes: 3