From: Aman Thind <[EMAIL PROTECTED]>
> Please help me sort the following two issues :
See below.
> 1 ) I cannot display the Sent time in MS Outlook in a mail generated
> using Net::SMTP.
> With the code I am using , the Sent field in the Outlook pane
> comes
> blank.
>
> 2 ) I cannot reply to the mail received using this code.The email
> address information is lost on using names instead of email addresses
> in the To and Cc tabs. How can I display names and allow a
> reply-to-all too ?
>
>
> Here is the code I am using :
>
> ----------------------------------------------------------------------
> ------ -----------------------------------------------------
>
> use Net::SMTP;
>
> $sender = '[EMAIL PROTECTED]';
>
> $subject = "Just a test...pls ignore";
>
> $body = "\n
> <html>
> <body>
> <font size= -1><font color =
> red><B>IMPORTANT:</B></font> This information is for internal
> authorized use only.
> </font>
> </body>
> </html>
>
> ";
>
> my $smtp = Net::SMTP->new('my_mail_server_name');
> #what mailserver to use
> # Sender's Address
> $smtp->mail('[EMAIL PROTECTED]');
> # Who will receive the notification mail?
>
> $smtp->to('[EMAIL PROTECTED]','[EMAIL PROTECTED]','mkashyap@quark.
> co.in' );
>
> #place the actual data within the email
> $smtp->data();
> $smtp->datasend("Content-type: text/html\n");
#time diference to GMT - Windows will not set $ENV{'TZ'}, if you know a better way ...
my $GMTdiff;
{
my $time = time();
my @local = (localtime($time))[2,1,3,4,5]; # hour, minute, mday, month, year;
I don't mind year is 1900 based and month 0-11
my @gm = (gmtime($time))[2,1,3,4,5];
my $diffdate = ($gm[4]*512*32 + $gm[3]*32 + $gm[2]) <=> ($local[4]*512*32 +
$local[3]*32 + $local[2]); # I know there are 12 months and 365-366 days. Any bigger
numbers work fine as well ;-)
if ($diffdate > 0) {$gm[0]+=24}
elsif ($diffdate < 0) {$local[0]+=24}
my $hourdiff = $gm[0]-$local[0];
my $mindiff;
if (abs($gm[1]-$local[1])<5) {
$mindiff = 0
} elsif (abs($gm[1]-$local[1]-30) <5) {
$mindiff = 30
} elsif (abs($gm[1]-$local[1]-60) <5) {
$mindiff = 0;
$hourdiff ++;
}
$GMTdiff = ($hourdiff < 0 ? '+' : '-') . sprintf "%02d%02d", abs($hourdiff),
$mindiff;
}
my $date = localtime();
$date =~ s/^(\w+)\s+(\w+)\s+(\d+)\s+(\d+:\d+:\d+)\s+(\d+)$/$1, $3 $2 $5 $4/;
$smtp->datasend("Date: $date $GMTdiff\n";
> $smtp->datasend("From: Aman Thind\n");
$smtp->datasend("From: \"Aman Thind\" <[EMAIL PROTECTED]>\n");
Same for the other addresses.
> $smtp->datasend("To : Aman Thind\n");
> $smtp->datasend("Cc : Shishir Saxena; Manish Kashyap\n");
> $smtp->datasend("Subject : ".$subject."\n");
> #Here is the body
> $smtp->datasend("\n");
> $smtp->datasend($body);
> $smtp->dataend();
> $smtp->quit;
HTH, Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]