Thread Emails: mal wieder :-/ (7 answers)
Opened by Free Faq at 2004-07-13 00:33

esskar
 2004-07-13 02:00
#3146 #3146
User since
2003-08-04
7321 Artikel
ModeratorIn

user image
geht doch

Code: (dl )
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
use strict;
use Net::SMTP;

my @email_addrs = ('test1@company.dot', 'test2@company.dot', 'test3@company.dot');

my $from = 'from@company.dot';
my $subject = "das ist ein test!";
my $body = qq~Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.~;

foreach my $to (@email_addrs)
{
email_send($to, $from, $subject, $body);
}

sub email_send
{
my ($to, $from, $subject, $text) = @_;
my $smtp;

$smtp = Net::SMTP->new("127.0.0.1") or die $@;
$smtp->mail($from);
$smtp->to($to);
$smtp->data();
$smtp->datasend("Subject: $subject\n");
$smtp->datasend("To: $to\n");
$smtp->datasend("\n");
$smtp->datasend($text);
$smtp->dataend();
$smtp->quit();
}


Hast du auch einen SMTP Server lokal laufen?

View full thread Emails: mal wieder :-/