www.fromthevalley.com.au

Sendmail Example

  1 #!/usr/bin/perl
  2
  3
  4
  5 &sendmail('[email protected]','[email protected]','test subject','this is a nice message');
  6
  7 sub sendmail{
  8
  9     my $from    = shift ||'[email protected]';
 10     my $to      = shift || '[email protected]';
 11     my $subject = shift;
 12     my $body    = shift;
 13
 14     # SEND EMAIL
 15     open(MAIL, "| /usr/sbin/sendmail -t") || die "Could not fork sendmail: $!";
 16     print MAIL "From: $from\n";
 17     print MAIL "To: $to\n";
 18     print MAIL "Subject: $subject\n";
 19     print MAIL "Content-type: text/html\n\n";
 20     print MAIL $body;
 21     close MAIL;
 22
HOMEAJAXAPACHEBizphoneCSSDNSGeneralGraphicsHTMLHardwareJavascriptLinuxMACMS SQLMailMicrosoftOFFICE 365PerlPostgresSEOSocial MediaVMwareWindows 10