Here is a typical usage of this program.
#!/usr/bin/perl
# Send emails via this platform independent module
use Mail::Sendmail;
main();
sub main {
 my ($to, $subject, $message) = @ARGV;
 send_email($to, $subject, $message);
}
# Sends email using Mail::Sendmail module
sub send_email {
 my ($to, $subject, $message) = @_;
 my ($mailhost, $from, %mail, @to);
 $mailhost = "smtp.mydomain.com";
 $from     = "itm_alerts\@mydomain.com";
 %mail = (
    Smtp => $mailhost,
    From => $from,
    To   => $to,
    Subject => $subject,
    Message => $message,
 );
 sendmail(%mail);
}
Hope you find it useful.
No comments:
Post a Comment