X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/1d08c1e0c0de0d321883ece1c36bce851fe893c7..b797ae637bde7403d5b767bcca4b193cdc5afce2:/mts/smtp/smtp.c diff --git a/mts/smtp/smtp.c b/mts/smtp/smtp.c index 4fb6b1f4..b5e68fa1 100644 --- a/mts/smtp/smtp.c +++ b/mts/smtp/smtp.c @@ -441,9 +441,22 @@ rclient (char *server, char *service) } int -sm_winit (char *from) +sm_winit (char *from, int smtputf8) { - switch (smtalk (SM_MAIL, "MAIL FROM:<%s>", from)) { + const char *const mail_parameters = smtputf8 + ? " BODY=8BITMIME SMTPUTF8" + : ""; + + /* Just for information, if an attempt is made to send to an 8-bit + address without specifying SMTPUTF8, Gmail responds with + 555 5.5.2 Syntax error. + Gmail doesn't require the 8BITMIME, but RFC 6531 Sec. 1.2 does. */ + if (smtputf8 && (! EHLOset("8BITMIME") || ! EHLOset("SMTPUTF8"))) { + sm_end (NOTOK); + return RP_UCMD; + } + + switch (smtalk (SM_MAIL, "MAIL FROM:<%s>%s", from, mail_parameters)) { case 250: sm_addrs = 0; return RP_OK;