meenac has asked for the wisdom of the Perl Monks concerning the following question:


Hi All,

I have the following code running on Win 2K and I am
using active perl.
use Net::SMTP; # connect to an SMTP server $smtp = Net::SMTP->new('SMTP Server'); $smtp->mail( "sender address" ); $smtp->to("receipient address"); $smtp->data(); $smtp->datasend("To: receipient address"\n"); $smtp->datasend("From: sender address\n"); $smtp->datasend("Subject : Analysis Summary\n"); $smtp->datasend('c:\temp\analysis.csv'); $smtp->datasend(); $smtp->quit;

When I run this code, no subject is sent. The
sent timestamp is none as well. How can I add a
subject line and a send timestamp to this email?

thanks.

Replies are listed 'Best First'.
Re: Add Subject and timestamp to email
by friedo (Prior) on Dec 29, 2004 at 16:22 UTC
    You need to have a second newline after your headers. Try:
    $smtp->datasend("To: receipient address"\n"); $smtp->datasend("From: sender address\n"); $smtp->datasend("Subject : Analysis Summary\n"); $smtp->datasend("\n"); $smtp->datasend('c:\temp\analysis.csv'); $smtp->dataend; $smtp->quit;


      Dear friedo,

      Thank you for your suggestion and it worked for
      adding the subject.
      Now, I need to add timestamp to the email.
      Any Suggestions?

      thanks.
Re: Add Subject and timestamp to email
by Crackers2 (Parson) on Dec 29, 2004 at 17:43 UTC
    In addition to what friedo said, I don't think the space between "Subject" and ":" is allowed. Try getting rid of that and see if it makes a difference.