splitbrain / dokuwiki-plugin-smtp

Send DokuWiki mails via a configured SMTP server
https://www.dokuwiki.org/plugin:smtp
12 stars 14 forks source link

Fix invalid HELO command in case of IPv6 #51

Closed trollkotze closed 1 year ago

trollkotze commented 1 year ago

In the case that SERVER_ADDR is IPv6 (I think this is always the case when the remote visitor of the website is accessing it via IPv6), the string "IPv6:" needs to be prepended according to RFC 2821, or SMTP servers like postfix will reject the HELO due to "invalid ip address". Visitors who connect via IPv4 would not encounter this error I think, because SERVER_ADDR would then also be the IPv4 address of the server.

Maybe even better would be to always use IPv4 if the server does have an IPv4 address, even if it is visited via IPv6 at the moment. But I don't know a PHP method to just get the IPv4 address. Only a few years ago I often encountered problems with IPv6, with many mail servers (incl. GMail) rejecting mail that was sent via IPv6 due to configuration errors. But one can hope that this should be a thing of the past now.