neotide1976
asked on
Automated Perl email with generated date in subject
Hello,
I'm trying to generate a daily automated HTML email using Perl and MIME::Lite. I have most of what I want working coming to Outlook 2007 clients although I cannot for the life of me get the date to work since moving from text to HTML. The date should be generated behind the subject. I'm a Perl noob so any guidance would be greatly appreciated!
I'm trying to generate a daily automated HTML email using Perl and MIME::Lite. I have most of what I want working coming to Outlook 2007 clients although I cannot for the life of me get the date to work since moving from text to HTML. The date should be generated behind the subject. I'm a Perl noob so any guidance would be greatly appreciated!
#!/usr/bin/perl -w
use strict;
use MIME::Lite;
# SendTo email id
my $email = 'user@place.com';
# Date
my $date = 'date';
# create a new MIME Lite based email
my $msg = MIME::Lite->new
(
Subject => $date,
From => 'group@place.com',
To => $email,
Type => 'text/html',
Data => '<html>
<body lang=EN-US link=blue vlink=purple>
<p><b>-Stuff I am working on:</b></p>
<p><b>-Stuff I want looked over:</b></p>
</body>
</html>'
);
$msg->send;
or with builtin function:
my $date=localtime(time);
ASKER
That worked great! Now when I add the rest of the subject before it though I get errors when trying to run the script.
Subject => 'Daily Email Report'$date,
Subject => 'Daily Email Report'$date,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for your help. This worked a treat and saved me from pulling the rest of my hair out.
Or use double-quote interpolation:
Subject => "Daily Email Report: $date",
e.g.
Open in new window