Re: [PATCH] send-email: Change from Mail::Sendmail to Net::SMTP
From: Martin Langhoff <hidden>
Date: 2016-06-15 22:42:24
On 3/26/06, Eric Wong [off-list ref] wrote:
Net::SMTP is in the base Perl distribution, so users are more likely to have it. Net::SMTP also allows reusing the SMTP connection, so sending multiple emails is faster.
This is causing problems for me on my Debian sarge dev box. * If I have to believe strace(), Net::SMTP is trying to look up "localhost" via DNS. Sketchy workaround: use 127.0.0.1. * This box has nothing listening on port 25. It doesn't get email from the net, being a LAN machine, so I've told the debian config system that we don't need an smtp daemon. Net::SMTP doesn't know how to use /usr/bin/sendmail * That nasty @@VERSION@@ thing isn't valid perl, so working on this code is a pain. Something like this (warning! broken diff ahead!) fixes it for me.
@@ -292,6 +292,11 @@ sub send_message @recipients = unique_email_list(@recipients,@cc); my $date = strftime('%a, %d %b %Y %H:%M:%S %z', localtime($time++)); + my $gitversion = '@@GIT_VERSION@@'; + if ($gitversion eq '@@'.'GIT_VERSION@@') { + $gitversion = `git --version`; + } + my $header = "From: $from To: $to Cc: $cc
@@ -299,11 +304,11 @@ Subject: $subject Reply-To: $from Date: $date Message-Id: $message_id -X-Mailer: git-send-email @@GIT_VERSION@@ +X-Mailer: git-send-email $gitversion "; $header .= "In-Reply-To: $reply_to\n" if $reply_to;
cheers, martin