LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Changing the mail Header using Perl Email Script (https://www.linuxquestions.org/questions/programming-9/changing-the-mail-header-using-perl-email-script-686847/)

athreyavc 11-28-2008 06:56 AM

Changing the mail Header using Perl Email Script
 
Hi All,

I am a newbie to Perl Programming.

I want to send an email using perl Script. I am able to do that. Perl Script is running on a Solaris machine

But the From ID conatins the system name in the ID.

storage_admin.alt.ka@sm-ccstorage-1.alt.na.ka


Please see the Script below,

open (INFO, "/athreya/Qtrees");
@result=<INFO>;
close(INFO);
print @result;

$mailprog = '/usr/lib/sendmail';

open(MAIL,"|$mailprog -t");

print MAIL "To: athreya\@alt.ka\n";
print MAIL "From: storage@alt.ka\n";
print MAIL "Subject: $subject\n\n";


## Mail Body
print MAIL "Below Qtrees are nearing Full. Please do the Needful\n";
print MAIL @result;
print MAIL "\n";
print MAIL "Best Regards\n";
print MAIL "IT Admin";

close(MAIL);


Can in any way we change the From header?

Thanks and Regards,

Athreya VC

Sergei Steshenko 11-28-2008 07:07 AM

perldoc perle
.

And _always_ use 'use strict;', 'use warnings;'.


All times are GMT -5. The time now is 03:32 PM.