/ Published in: Perl
Expand |
Embed | Plain Text
my $to = "them\@gmail.com"; my $subject = "Test"; my $reply_to = "you\@gmail.com"; my $content = "This is a test"; #check address (from perlfaq 9) ]|[^\\"])*"}; my $local = qr{(?:$dot_atom|$quoted)}; my $quotedpair = qr{\\[\x00-\x09\x0B-\x0c\x0e-\x7e]}; my $domain_lit = qr{\[(?:$quotedpair|[\x21-\x5a\x5e-\x7e])*\]}; my $domain = qr{(?:$dot_atom|$domain_lit)}; my $addr_spec = qr{$local\@$domain}; die ( "Invalid To: address $to\n" ) unless ($to =~ /^${addr_spec}$/); die ( "Invalid reply_to: address $reply_to\n" ) unless ($reply_to =~ /^${addr_spec}$/); my $sendmail = "/usr/sbin/sendmail -t -oi"; my $send_to = "To: $to"; my $send_reply_to = "Reply-to: $reply_to"; my $send_subject = "Subject: $subject"; local $\ = "\n"; print SENDMAIL $send_to; print SENDMAIL $send_reply_to; print SENDMAIL $send_subject; #extra \n is REQUIRED print SENDMAIL "Content-type: text/plain\n"; print SENDMAIL $content; close( SENDMAIL );
You need to login to post a comment.
