Sendmail on Linux

Sendmail is shipped with many Linux distribution. We can use it to send emails.  Before it can send mails, you need to configure the smtp server for it firstly.

http://www.yolinux.com/TUTORIALS/Sendmail.html

Below is a snippet using Perl to invoke /usr/lib/sendmail to send mail. You can enhance it to send a beautiful report by yourself.

sub send_mail
{

$to="luohua.huang\@gmail.com,abc.def\@gmail.com";
open(MAIL,'|/usr/lib/sendmail -t -f notificationemail');
print (MAIL "To: $to \r\n");
print MAIL "Subject: Build $status \n";
print MAIL "Please check report $link \n";
close (MAIL);
}

# It seems sendmail is a bit fussy and you have to follow the ordering to set its content (to->from->subject->message).