Skip to content

Commit

Permalink
Item11134: Email fixes from TimotheLitt
Browse files Browse the repository at this point in the history
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
  • Loading branch information
GeorgeClark authored and GeorgeClark committed Sep 19, 2011
1 parent 1597a05 commit f04264f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 0 additions & 5 deletions core/bin/configure
Expand Up @@ -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} ) {
Expand Down
7 changes: 6 additions & 1 deletion core/lib/Foswiki/Net.pm
Expand Up @@ -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
Expand Down Expand Up @@ -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} )
Expand Down

0 comments on commit f04264f

Please sign in to comment.