randomact has asked for the wisdom of the Perl Monks concerning the following question:
Am sending an email to an Address on a linux server in the aliases file, it then runs script. Works great, but I need to include the message not the "test" that I send to that email. Basically, I need a script to forward a email message but change the From and Subject.
#!/usr/bin/perl -w print "Content-type: text/html\n\n"; #$title='Perl Mail demo'; $to='newaddress@mydomain.com'; $from= 'newfrom@anotherdomain.com'; $subject='newsubject'; $body='This is a test'; open(MAIL, "|/usr/sbin/sendmail -t"); ## Mail Header print MAIL "To: $to\n"; print MAIL "From: $from\n"; print MAIL "Subject: $subject\n\n"; ## Mail Body print MAIL "$body\n"; $body = substr($body,0,500); close(MAIL); print "<html><head><title>$title</title></head>\n<body>\n\n"; ## HTML content sent, let use know we sent an email print "<h1>$title</h1><p>A message has been sent from $from to $to</p></body></html>";
Thanks for the Help
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Email Forwarding
by aitap (Curate) on Feb 05, 2013 at 18:24 UTC | |
by Anonymous Monk on Feb 05, 2013 at 18:32 UTC | |
by aitap (Curate) on Feb 05, 2013 at 18:42 UTC |
Back to
Seekers of Perl Wisdom