[PHP-DEV] IMAP patch From: Sean Farley (scf <email protected>)
Date: 10/10/00

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 <email protected> 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 <email protected>
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;

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>