FAQ
I was wondering if someone could point me in the right direction for
using the Mail::Mailer module. I have two questions:

I have a simple script to mail log files to systems administrators using
Mail::Mailer --that works fine as it is.

1. Date/Timestamp modification: But I notice that if I pass today's date to
the Mailer using using the "localtime(time)" function, the date that
appears on my email system shows the correct date but a time that's 4 hours
earlier. I thought that maybe it was correcting the time to GMT but this
timestamp is 4 hours more westerly, not easterly at GMT would be. All the
servers and PCs involved point to the same timeserver and that seems fine.

I'm in the U.S. Eastern time zone. The variable, $todaysdate, that
picks up the localtime string shows the correct date and time, before it's
sent off with the Mailer header information but not when it's received from
my mail viewer, Windows Outlook. I notice that the properties on the
Outlook message shows the received and modified times for the message
properly but not the sent time. So it appears that somewhere between my
system, the SMTP server and my Exchange server, the message is getting its
timestamp altered. Any ideas?

2. Any recommendations on performing error checks for the mailer close
results? It looks like it'll take almost anything but an unavailable SMTP
server, and still return true to the "mailer close" command. Does anyone
have a better approach for checking whether the message is delivered or not?

Thanks

Jeff Smith
+++++++++++++++++
Below is the working snippet:

....
my $return;
my $mailer = my $from_address = my @to_address = my $subject = my $body = my
$sentdate = ();

$from_address = 'jeff.d.smith@domain.xyz';
@to_address = ('jeff.d.smith@domain.xyz');
$sentdate = localtime(time);
print "sentdate is $sentdate\n";
print "@to_address are the addressees\n";
$subject = 'Test Mail Message from PERL Script';
$body = "HI THERE\n";
#print "$from_address $to_address $subject $body are args\n";
#mailer = new Mail::Mailer 'test', Server => 'abcserver.domain.xyz';
$mailer = new Mail::Mailer 'smtp', Server =>'abcserver.domain.xyz';
$mailer->open({ "From" => $from_address,
"To" => \@to_address,
"Subject" => $subject,
"Date" => $sentdate,
})
or die "Can't open: $!\n";
print $mailer <<EOF;
.......Message Text follows...
.......................
EOF
$return = $mailer->close();
Print $return; # Always 1 it seems---
#End

Search Discussions

  • John W. Krahn at Jun 16, 2003 at 7:38 pm

    Smith Jeff D wrote:

    I was wondering if someone could point me in the right direction for
    using the Mail::Mailer module. I have two questions:

    I have a simple script to mail log files to systems administrators using
    Mail::Mailer --that works fine as it is.

    1. Date/Timestamp modification: But I notice that if I pass today's date to
    the Mailer using using the "localtime(time)" function, the date that
    appears on my email system shows the correct date but a time that's 4 hours
    earlier. I thought that maybe it was correcting the time to GMT but this
    timestamp is 4 hours more westerly, not easterly at GMT would be. All the
    servers and PCs involved point to the same timeserver and that seems fine.

    I'm in the U.S. Eastern time zone. The variable, $todaysdate, that
    picks up the localtime string shows the correct date and time, before it's
    sent off with the Mailer header information but not when it's received from
    my mail viewer, Windows Outlook. I notice that the properties on the
    Outlook message shows the received and modified times for the message
    properly but not the sent time. So it appears that somewhere between my
    system, the SMTP server and my Exchange server, the message is getting its
    timestamp altered. Any ideas?
    Perhaps this module is what you want:
    http://search.cpan.org/author/HATA/Mail-Date-0.08/


    John
    --
    use Perl;
    program
    fulfillment
  • Smith Jeff D at Jun 16, 2003 at 7:56 pm
    Thanks, I'll try it. But I'll have to go to 5.8 from 5.6, which Activestate
    has advised against since the Windows 5.8 is so buggy. I'll try it and let
    you know.

    -----Original Message-----
    From: John W. Krahn
    Sent: Monday, June 16, 2003 3:38 PM
    To: beginners@perl.org
    Subject: Re: Mial::Mailer Date Stamp and Error Handling using SMTP Service


    Smith Jeff D wrote:
    I was wondering if someone could point me in the right
    direction for using the Mail::Mailer module. I have two questions:

    I have a simple script to mail log files to systems administrators
    using Mail::Mailer --that works fine as it is.

    1. Date/Timestamp modification: But I notice that if I pass today's
    date to the Mailer using using the "localtime(time)" function, the
    date that appears on my email system shows the correct date but a time
    that's 4 hours earlier. I thought that maybe it was correcting the
    time to GMT but this timestamp is 4 hours more westerly, not easterly
    at GMT would be. All the servers and PCs involved point to the same
    timeserver and that seems fine.

    I'm in the U.S. Eastern time zone. The variable, $todaysdate,
    that picks up the localtime string shows the correct date and time,
    before it's sent off with the Mailer header information but not when
    it's received from my mail viewer, Windows Outlook. I notice that the
    properties on the Outlook message shows the received and modified
    times for the message properly but not the sent time. So it appears
    that somewhere between my system, the SMTP server and my Exchange
    server, the message is getting its timestamp altered. Any ideas?
    Perhaps this module is what you want:
    http://search.cpan.org/author/HATA/Mail-Date-0.08/


    John
    --
    use Perl;
    program
    fulfillment

    --
    To unsubscribe, e-mail: beginners-unsubscribe@perl.org
    For additional commands, e-mail: beginners-help@perl.org
  • Smith Jeff D at Jun 16, 2003 at 8:11 pm
    That addresses the first part--even though I didn't install the new 5.8
    module yet, changing the date string format to the new RFC standard format
    before sending it off to the mailer changes the date/timestamp on the
    message correctly.

    Anyone have a better approach toward error-trapping the results of sending
    the message to the SMTP server?

    Thanks John.

    -----Original Message-----
    From: John W. Krahn
    Sent: Monday, June 16, 2003 3:38 PM
    To: beginners@perl.org
    Subject: Re: Mial::Mailer Date Stamp and Error Handling using SMTP Service


    Smith Jeff D wrote:
    I was wondering if someone could point me in the right
    direction for using the Mail::Mailer module. I have two questions:

    I have a simple script to mail log files to systems administrators
    using Mail::Mailer --that works fine as it is.

    1. Date/Timestamp modification: But I notice that if I pass today's
    date to the Mailer using using the "localtime(time)" function, the
    date that appears on my email system shows the correct date but a time
    that's 4 hours earlier. I thought that maybe it was correcting the
    time to GMT but this timestamp is 4 hours more westerly, not easterly
    at GMT would be. All the servers and PCs involved point to the same
    timeserver and that seems fine.

    I'm in the U.S. Eastern time zone. The variable, $todaysdate,
    that picks up the localtime string shows the correct date and time,
    before it's sent off with the Mailer header information but not when
    it's received from my mail viewer, Windows Outlook. I notice that the
    properties on the Outlook message shows the received and modified
    times for the message properly but not the sent time. So it appears
    that somewhere between my system, the SMTP server and my Exchange
    server, the message is getting its timestamp altered. Any ideas?
    Perhaps this module is what you want:
    http://search.cpan.org/author/HATA/Mail-Date-0.08/


    John
    --
    use Perl;
    program
    fulfillment

    --
    To unsubscribe, e-mail: beginners-unsubscribe@perl.org
    For additional commands, e-mail: beginners-help@perl.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupbeginners @
categoriesperl
postedJun 16, '03 at 7:13p
activeJun 16, '03 at 8:11p
posts4
users2
websiteperl.org

2 users in discussion

Smith Jeff D: 3 posts John W. Krahn: 1 post

People

Translate

site design / logo © 2021 Grokbase