tags 694686 + patch
kthxbye

I've attached a patch that does the minimum necessary to fix the
problem.  It passes the -B8BITMIME option, which is supported by every
/usr/sbin/sendmail implementation I can find, and adds a MIME-Version
header.  It also sets the Content-Transfer-Encoding to 8bit if no such
header is already present.

This is the minimum necessary for cron to properly send 8-bit emails.
I'm running it on my server and have seen no problems with it.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
commit 1c9ebe291e3b837ec10734fc8c37211e792d9ad5
Author: brian m. carlson <sand...@crustytoothpaste.net>
Date:   Wed Apr 30 23:35:25 2014 +0000

    Send proper 8-bit emails.
    
    Cron sends 8-bit emails, so it needs to send these mails as 8BITMIME.  This
    involves passing -B8BITMIME so that sendmail knows what kind of data to
    expect, as well as sending an appropriate MIME-Version and
    Content-Transfer-Encoding header.
    
    Without these changes, mail servers that reject non-MIME 8-bit emails will
    reject cron's messages.

diff --git a/config.h b/config.h
index cb10abd..611a335 100644
--- a/config.h
+++ b/config.h
@@ -44,7 +44,7 @@
 
 #define MAILCMD _PATH_SENDMAIL                                 /*-*/
 /* #define MAILARGS "%s -i -FCronDaemon -odi -oem  %s"         /*-*/
-#define MAILARGS "%s -i -FCronDaemon -oem  %s"         /*-*/
+#define MAILARGS "%s -i -FCronDaemon -B8BITMIME -oem  %s"              /*-*/
                        /* -i    = don't terminate on "." by itself
                          * -Fx  = set full-name of sender
                         * -odi  = Option Deliverymode Interactive
diff --git a/do_command.c b/do_command.c
index 18d097d..9f7240a 100644
--- a/do_command.c
+++ b/do_command.c
@@ -567,6 +567,7 @@ child_process(e, u)
        fprintf(mail, "Date: %s\n",
                        arpadate(&StartTime));
 # endif /* MAIL_DATE */
+       fprintf(mail, "MIME-Version: 1.0\n");
        if ( content_type == 0L ) {
                fprintf(mail, "Content-Type: text/plain; charset=%s\n",
                                cron_default_mail_charset
@@ -595,6 +596,8 @@ child_process(e, u)
 
                fprintf(mail,"Content-Transfer-Encoding: %s\n", 
content_transfer_encoding);
        }
+       else
+               fprintf(mail, "Content-Transfer-Encoding: 8bit\n");
 
        for (env = e->envp;  *env;  env++)
                fprintf(mail, "X-Cron-Env: <%s>\n",

Attachment: signature.asc
Description: Digital signature

Reply via email to