1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2026-01-07 17:47:14 +00:00

courier: Use the senders' domain when saying EHLO

Some servers, like postfix, will pay close attention to the domain we say as a
part of the EHLO.

By default, Go's smtp package will use "localhost", causing it to complain.

This patch fixes that by using the envelope-from's domain.
It's not clear if that's better than using what we are resolving to, but
that's much more involved so we're going to do this for now.
This commit is contained in:
Alberto Bertogli
2016-10-01 18:00:53 +01:00
parent 280939c3ec
commit 2f2d1f2dbd
2 changed files with 11 additions and 5 deletions

View File

@@ -59,7 +59,7 @@ func TestSMTP(t *testing.T) {
responses := map[string]string{
"_welcome": "220 welcome\n",
"EHLO localhost": "250 ehlo ok\n",
"EHLO me": "250 ehlo ok\n",
"MAIL FROM:<me@me>": "250 mail ok\n",
"RCPT TO:<to@to>": "250 rcpt ok\n",
"DATA": "354 send data\n",
@@ -93,14 +93,14 @@ func TestSMTPErrors(t *testing.T) {
// MAIL FROM not allowed.
{
"_welcome": "220 mail from not allowed\n",
"EHLO localhost": "250 ehlo ok\n",
"EHLO me": "250 ehlo ok\n",
"MAIL FROM:<me@me>": "501 mail error\n",
},
// RCPT TO not allowed.
{
"_welcome": "220 rcpt to not allowed\n",
"EHLO localhost": "250 ehlo ok\n",
"EHLO me": "250 ehlo ok\n",
"MAIL FROM:<me@me>": "250 mail ok\n",
"RCPT TO:<to@to>": "501 rcpt error\n",
},
@@ -108,7 +108,7 @@ func TestSMTPErrors(t *testing.T) {
// DATA error.
{
"_welcome": "220 data error\n",
"EHLO localhost": "250 ehlo ok\n",
"EHLO me": "250 ehlo ok\n",
"MAIL FROM:<me@me>": "250 mail ok\n",
"RCPT TO:<to@to>": "250 rcpt ok\n",
"DATA": "554 data error\n",
@@ -117,7 +117,7 @@ func TestSMTPErrors(t *testing.T) {
// DATA response error.
{
"_welcome": "220 data response error\n",
"EHLO localhost": "250 ehlo ok\n",
"EHLO me": "250 ehlo ok\n",
"MAIL FROM:<me@me>": "250 mail ok\n",
"RCPT TO:<to@to>": "250 rcpt ok\n",
"DATA": "354 send data\n",