Advertisement
Advertisement
| 06.17.2008 at 02:15PM PDT, ID: 23493311 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: |
#!/usr/bin/perl -w
use Net::SMTP;
use CGI;
my $cgi = new CGI;
sub send_mail
{
my $to = $_[0];
my $subject = $_[1];
my $body = $_[2];
my $from = $_[3];
my $smtp;
if (not $smtp = Net::SMTP->new('mail.server.com', Port => 25, Debug => 1))
{
die "Could not connect to server\n";
}
$smtp->mail($from . "\n");
my @recepients = split(/,/, $to);
foreach my $recp (@recepients)
{
$smtp->to($recp . "\n");
}
$smtp->data();
$smtp->datasend("From: " . $from . "\n");
$smtp->datasend("To: " . $to . "\n");
$smtp->datasend("Subject: " . $subject . "\n");
$smtp->datasend("\n");
$smtp->datasend($body . "\n");
$smtp->dataend();
$smtp->quit;
}
# Send away!
&send_mail($cgi->param('to'), $cgi->param('subject'), $cgi->param('body'), $cgi->param('from'));
print $cgi->header;
print '<html><body>Your e-mail has been sent</body></html>';
|