Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Thanks in advance#!/usr/bin/perl -w use strict; use warnings; use NET::SMTP; my $servername="testserver.com"; my $from="jon@testserver.com"; my $to="jon@testserver.com,ted@testserver.com"; my $subject="test email"; my @body=("testmail"); my $smtp = Net::SMTP->new($servername) || die "unable to connect to se +rver: $servername\n"; die "Could not open connection: $!" if (!defined $smtp); $smtp->mail($from) || die "unable to set sender: $from\n"; $smtp->to($to) || die "unable to set recipient: $to\n"; $smtp->data(); $smtp->datasend("To: $to\n") || die "unable to send data: $to\n"; $smtp->datasend("From: $from\n") || die "unable to send data: $fro +m\n"; $smtp->datasend("Subject: $subject\n")|| die "unable to send data: + $subject\n"; $smtp->datasend("\n")|| die "unable to send data: \@body\n"; foreach (@body){ $smtp->datasend("$_\n"); } $smtp->dataend(); $smtp->quit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sending to multiple recipients with Net::SMTP
by muntfish (Chaplain) on Nov 08, 2004 at 13:29 UTC | |
by nimdokk (Vicar) on Nov 08, 2004 at 13:45 UTC | |
by muntfish (Chaplain) on Nov 08, 2004 at 13:52 UTC | |
by nimdokk (Vicar) on Nov 08, 2004 at 16:28 UTC | |
by Anonymous Monk on Nov 08, 2004 at 13:48 UTC |