#!/usr/bin/env perl # postman.pl use warnings; use strict; use Data::Dumper; my $sendmail = "/usr/sbin/sendmail -t"; my $reply_to = "Reply-to: <mymaild>\@<mymailbox>.com\n"; my $subject = "Subject: <subjectline>\n"; my $content = "Welcome to ooty, nice to meet you\n"; ## not used actua +lly read from file instead of this my $from = "From: "."<mymaild>\@<mymailbox>.com\n"; my $to = "To: "."<yourmaild&>\@<yourmailboxgt\n"; my $regfolder=`date +%m%d%Y`; my $dateString=`date +%m.%d.%Y`; ##### Change directory to the folder of file my $cmdString = "/home/logfiles/$regfolder"; chdir($cmdString)|| die "Error: could not '$cmdString'"; ##### Mailing the contents my $file = "Myspace$dateString.html"; open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail: $!"; print SENDMAIL $reply_to; print SENDMAIL $subject; print SENDMAIL $from; print SENDMAIL $to; print SENDMAIL "Content-type: text/html\n\n"; open(FILE, "$file") or die "Cannot open $file: $!"; print SENDMAIL <FILE> close(FILE); close(SENDMAIL);
In reply to Send email using perl and sendmail by sKore
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |