Mail: Can't send emails in IPv6 network

REPRODUCIBILITY (% or how often): always
HARDWARE (Jolla1, Tablet, XA2,…): Xperia X, Gemini
REGRESSION: (compared to previous public release: Yes, No, ?): No


When sending emails in a IPv6 network, the Mail app sends the IP address in a wrong format during EHLO to the SMTP server. Therefore most SMTP servers will refuse to accept those emails. Sending emails fails.


  • IPv6 network
  • SMTP server that does basic checks on the EHLO fields


  1. Send email in Mail app


Email gets send


Email does not get send


When connecting to the SMTP server, the Mail app sends the following EHLO (excerpt of Posfix error log):

Apr 15 17:25:20 router postfix/smtpd[101678]: NOQUEUE: reject: EHLO from unknown[2a03:2260:116:0:2a3f:69ff:fecd:446]: 501 5.5.2 <[2a03:2260:116:0:2a3f:69ff:fecd:446]>: Helo command rejected: invalid ip address; proto=SMTP helo=<[2a03:2260:116:0:2a3f:69ff:fecd:446]>

The format of the IPv6 address is wrong.
Instead of “helo=<[2a03:2260:116:0:2a3f:69ff:fecd:446]>” it must be “helo=<[IPv6:2a03:2260:116:0:2a3f:69ff:fecd:446]>” - note the “IPv6:” before the IP address.

See RFC 2821, chapter 4.1.3


Is this a continuation of this one?

I thought to the same thing at the beginning, but as far as I understand, it’s a different issue on the same spot. The one addressed in the TJC report is about the fact that the interface is appended to the IP address, which is wrong. There is a patch upstream developped by @rainemak, see

The issue reported here seems new to me. I need to read the RFC pointed by the reporter (thanks for all the detail by the way). But it seems that the address is missing a prepended IPV6: tag this time, not sufferring from a wrong appended text.

1 Like

I’m running into the same problem and debugged it the same way from the old TJC thread :smiley:

I was actually waiting to upgrade my phone to 3.4.x first to see if it was fixed there, but here we are.

I’ve got an XA2 Plus, dual sim, running SFOS

This is still an issue in

1 Like

I can confirm that the issue is still there in Sailfish and in Mail

I have a Postfix e-mail server which has reject_non_fqdn_helo_hostname value in its configuration. Explanation for the configuration:

Reject the request when the HELO or EHLO hostname is not in fully-qualified domain or address literal form, as required by the RFC.

When Mail tries to send e-mail over SMTP over IPv6, the transmission is rejected by Postfix because Mail does not format the IPv6 address in the helo command according to RFC 2821 - Simple Mail Transfer Protocol, chapter 4.1.3 Address Literals.

Here’s the issue demonstrated with netcat (nc). In the helo command the client’s IPv6 address is enclosed in brackets. This formatting is rejected by Postfix. Addresses used in the examples are invalid for privacy reasons.

$ nc mail.foobar.invalid 25
220 mail.foobar.invalid ESMTP
helo [fe80::1]
250 mail.foobar.invalid
mail from: <foo@localhost.localdomain>
250 2.1.0 Ok
rcpt to: <bar@localhost.localdomain>
501 5.5.2 <[fe80::1]>: Helo command rejected: invalid ip address
221 2.0.0 Bye

Now consider the following SMTP command exchange. In it the IPv6 address is enclosed in brackets like before but the address is prefixed with IPv6:. This format is accepted by Postfix as it respects RFC 2821.

$ nc mail.foobar.invalid 25
220 mail.foobar.invalid ESMTP
helo [IPv6:fe80::1]
250 mail.foobar.invalid
mail from: <foo@localhost.localdomain>
250 2.1.0 Ok
rcpt to: <bar@localhost.localdomain>
250 2.1.5 Ok
221 2.0.0 Bye

The fix is thus simple: Mail should prefix the IPv6 address with IPv6: in the helo/ehlo command.


Still not fixed in 4.0.1.

Must be damn hard to prepend IPv6: to the IP address.

1 Like