IMAP patch

From: Date: Wed, 11 Oct 2000 02:18:51 +0000
Subject: IMAP patch
Groups: php.dev 
Request: Send a blank email to php-dev+get-34631@lists.php.net to get a copy of this message
This is a little patch I wrote for imap_mail() to better handle MIME content. It basically removes two newlines that can confuse my MUA. With Pine (at least), I need to have the MIME-Version header along with the other headers. There can be no blank lines in-between. I am using the following line: return (imap_mail($to, $subject, imap_mail_compose($envelope, $completeBody), "", $cc, $bcc, $this->username)); I realize I can place the cc, bcc, and from headers within the envelope, but this method avoided the "username@NO HOST" I was getting. The strlen(headers) is an important test since passing in "" or a 'null' result in headers pointing to something. I am not on the list so please e-mail me directly if their are any questions. Sean --------------- sean@farley.org PGP key: http://www.farley.org/~sean/pgp.key *** php-4.0.2/ext/imap/php_imap.c Thu Aug 24 13:49:48 2000 --- php-4.0.2/ext/imap/php_imap.c-patched Tue Oct 10 20:40:32 2000 *************** int _php_imap_mail(char *to, char *subje *** 3282,3291 **** if (cc && cc[0]) fprintf(sendmail, "Cc: %s\n", cc); if (bcc && bcc[0]) fprintf(sendmail, "Bcc: %s\n", bcc); fprintf(sendmail, "Subject: %s\n", subject); ! if (headers != NULL) { fprintf(sendmail, "%s\n", headers); } ! fprintf(sendmail, "\n%s\n", message); ret = pclose(sendmail); if (ret == -1) { return 0; --- 3282,3295 ---- if (cc && cc[0]) fprintf(sendmail, "Cc: %s\n", cc); if (bcc && bcc[0]) fprintf(sendmail, "Bcc: %s\n", bcc); fprintf(sendmail, "Subject: %s\n", subject); ! if ((headers != NULL) && (strlen(headers))) { fprintf(sendmail, "%s\n", headers); } ! if (strncmp(message, "MIME-Version:", strlen("MIME-Version:"))) ! { ! fprintf(sendmail, "\n", message); ! } ! fprintf(sendmail, "%s\n", message); ret = pclose(sendmail); if (ret == -1) { return 0;

« previous php.dev (#34631) next »