-# $Id: Mail.pm,v 1.1 2005/08/17 21:46:16 don Exp $
+# This module is part of debbugs, and is released
+# under the terms of the GPL version 2, or any later
+# version at your option.
+# See the file README and COPYING for more information.
+#
+# Copyright 2004-7 by Don Armstrong <don@donarmstrong.com>.
package Debbugs::Mail;
use base qw(Exporter);
use IPC::Open3;
-use POSIX ":sys_wait_h";
+use POSIX ":sys_wait_h strftime";
use Time::HiRes qw(usleep);
use Mail::Address ();
use Debbugs::MIME qw(encode_rfc1522);
$DEBUG = 0 unless defined $DEBUG;
@EXPORT = ();
- @EXPORT_OK = qw(send_mail_message get_addresses encode_headers);
+ @EXPORT_OK = qw(send_mail_message get_addresses encode_headers rfc822_date);
$EXPORT_TAGS{all} = [@EXPORT_OK];
}
my @recipients;
@recipients = @{$param{recipients}} if defined $param{recipients} and
ref($param{recipients}) eq 'ARRAY';
+ my %recipients;
+ @recipients{@recipients} = (1) x @recipients;
+ @recipients = keys %recipients;
# If there are no recipients, use -t to parse the message
if (@recipients == 0) {
$param{parse_for_recipients} = 1 unless exists $param{parse_for_recipients};
return $header . qq(\n\n). $body;
}
+=head2 rfc822_date
+
+ rfc822_date
+
+Return the current date in RFC822 format in the UTC timezone
+
+=cut
+
+sub rfc822_date{
+ return scalar strftime "%a, %d %h %Y %T +0000", gmtime;
+}
=head1 PRIVATE FUNCTIONS