On Wed, Mar 08, 2000 at 01:17:26PM +0100, VAHAGN AVEDIAN wrote:
>
> Is there a simple way to set the 'Subject' value when sending an email
> in PERL???
>
> I use the syntax:
>
> $MailAddress = "etxaved\@etxb.ericsson.se";
> $MailFileName = "message.txt";
> `mail $MailAddress < $MailFileName`;
>
> But since the subject is not set the received email gets a blank subject
> field.
>
> Is there a simple solution?

Hello, 

Below is something I have used from the Perl Cookbook.

Regards,

        Dan 
        [EMAIL PROTECTED]
        

# Perl Cookbook, page 651
open(SENDMAIL, "|/usr/lib/sendmail -t")
    or die "Can't fork for sendmail: $!\n";
print SENDMAIL <<"EOF";

From: "Error message from url-access cron" dcarrigan\@antioch-college.edu
To: dcarrigan\@antioch-college.edu
Subject: Error message from url-access cron

    url-access error, check,

    cat ~/perl/url-access.log | tail -15 | grep 500

EOF

close(SENDMAIL)     or warn "sendmail didn't close nicely";

Reply via email to