]> diplodocus.org Git - nmh/blobdiff - mts/smtp/smtp.c
Check that script(1) supports SHELL in test-version-check.
[nmh] / mts / smtp / smtp.c
index b5e68fa1fa6b03cc90d8ea8e3f2ab4046febed45..c94ac31308063d2de637c531b857779b5051bae3 100644 (file)
@@ -441,19 +441,33 @@ rclient (char *server, char *service)
 }
 
 int
-sm_winit (char *from, int smtputf8)
+sm_winit (char *from, int smtputf8, int eightbit)
 {
-    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;
+    const char *mail_parameters = "";
+
+    if (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 (EHLOset ("8BITMIME")  &&  EHLOset ("SMTPUTF8")) {
+            mail_parameters = " BODY=8BITMIME SMTPUTF8";
+        } else {
+            sm_end (NOTOK);
+            return RP_UCMD;
+        }
+    } else if (eightbit) {
+        /* Comply with RFC 6152, for messages that have any 8-bit characters
+           in their body. */
+        if (EHLOset ("8BITMIME")) {
+            mail_parameters = " BODY=8BITMIME";
+        } else {
+            advise (NULL, "SMTP server does not support 8BITMIME, not sending.\n"
+                    "Suggest encoding message for 7-bit transport by setting your\n"
+                    "locale to C, and/or specifying *b64 in mhbuild directives.\n");
+            sm_end (NOTOK);
+            return RP_UCMD;
+        }
     }
 
     switch (smtalk (SM_MAIL, "MAIL FROM:<%s>%s", from, mail_parameters)) {