From f04264fef0a1a5a9710d7bd656fd8c48ac7391ad Mon Sep 17 00:00:00 2001 From: GeorgeClark Date: Mon, 19 Sep 2011 02:24:58 +0000 Subject: [PATCH] Item11134: Email fixes from TimotheLitt Changes the test email from MIME with multi-part/mixed to MIME with text/plain to deal with issues in Outlook and also resolve the issue that there was no trailing boundary marker in the test message. Add a debug print for sendmail git-svn-id: http://svn.foswiki.org/trunk@12572 0b4bb1d4-4e5a-0410-9cc4-b2b747904278 --- core/bin/configure | 5 ----- core/lib/Foswiki/Net.pm | 7 ++++++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/bin/configure b/core/bin/configure index 791921df0d..fc8bf15a05 100755 --- a/core/bin/configure +++ b/core/bin/configure @@ -837,15 +837,10 @@ From: $Foswiki::cfg{WebMasterEmail} To: $Foswiki::cfg{WebMasterEmail} Subject: Test of Foswiki e-mail facility from configure MIME-Version: 1.0 -Content-Type: multipart/mixed; boundary="------------2D594AE113AD25493C2C7246" - -This is a multi-part message in MIME format. ---------------2D594AE113AD25493C2C7246 Content-Type: text/plain; charset=$charset Content-Transfer-Encoding: 8bit It Works! Test message from Foswiki. - MAIL if ( $Foswiki::cfg{WebMasterEmail} ) { diff --git a/core/lib/Foswiki/Net.pm b/core/lib/Foswiki/Net.pm index 6ba415b3c0..14f38b9510 100644 --- a/core/lib/Foswiki/Net.pm +++ b/core/lib/Foswiki/Net.pm @@ -384,7 +384,8 @@ sub sendEmail { catch Error::Simple with { my $e = shift->stringify(); ( my $to ) = $text =~ /^To:\s*(.*?)$/im; - $this->{session}->logger->log( 'warning', "Emailing $to - $e" ) if ($this->{session}); + $this->{session}->logger->log( 'warning', "Emailing $to - $e" ) + if ( $this->{session} ); # be nasty to errors that we didn't throw. They may be # caused by SMTP or perl, and give away info about the @@ -466,9 +467,13 @@ sub _sendEmailBySendmail { my ( $header, $body ) = split( "\n\n", $text, 2 ); $header =~ s/([\n\r])(From|To|CC|BCC)(\:\s*)([^\n\r]*)/$1.$2.$3._fixLineLength($4)/geois; + $text = "$header\n\n$body"; # rebuild message $this->_smimeSignMessage($text) if ( $Foswiki::cfg{Email}{EnableSMIME} ); + print STDERR +"====== Sending to $Foswiki::cfg{MailProgram} ======\n$text\n======EOM======\n" + if ( $Foswiki::cfg{SMTP}{Debug} ); my $MAIL; open( $MAIL, '|-', $Foswiki::cfg{MailProgram} )