i*****l 发帖数: 10 | 1 是否有牛人可赐一程序:
I want to send out emails to several different people with differnt names as
recipient.
EX: (in MS excel)
A B C
Last First Email
1 Liu Mary [email protected]
2 Liu Mery m*[email protected]
3 Liu Mory m*[email protected]
Once you click send, the message I wrote will be sent to addresses from column
C with the recipients from column B. | t******g 发帖数: 10390 | 2 我正好有一个用perl写的,可以在linux下用.
#!/usr/bin/perl
$mailprog='/usr/lib/sendmail -t';
#打开邮件列表文件.
open (FILE, "email.txt");
@file=;
close (FILE);
#分解邮件列表成名字和地址.
foreach $file_line(@file)
{ ($name, $emailaddress)=split(/\|/, $file_line);
&sendpass;
}
#发信
sub sendpass {
open (MAIL,"| $mailprog") || die "Mail system error";
print MAIL "to: $emailaddress";
print MAIL "Subject: 标题换成自己的\n";
print MAIL "From: xxx\@hotmail.com\n";
print MAIL <
Dear $name:
这里是信的内容,不过注意一些特殊字符可能导致出错,比如@需要写成\@才可以.上面的@也一样处
【在 i*****l 的大作中提到】 : 是否有牛人可赐一程序: : I want to send out emails to several different people with differnt names as : recipient. : EX: (in MS excel) : A B C : Last First Email : 1 Liu Mary [email protected] : 2 Liu Mery m*[email protected] : 3 Liu Mory m*[email protected] : Once you click send, the message I wrote will be sent to addresses from column
| i*****l 发帖数: 10 | 3 So I created two files: list.pl and email.txt
For list.pl , I just copied whatever you wrote as following:
For email.txt , I just wrote two lines as you mentioned below:
Then I ran this under unix:
~~~~~~~~~~~~~~~~~~~~~~~How?
Then I got a message:
Can't find string terminator "EOF" anywhere before EOF at list.pl line 21.
What do I do now? | t******g 发帖数: 10390 | 4 我看了一下,可能是你的EOF(倒数第二行,}上面那一行),结尾的地方有个空格.
把这个空格删了,EOF标记才能被认出来.
这个是我们通过浏览器传递文件出的问题.
关于打印进度,你可以参考这个程序:
#!/usr/bin/perl
$mailprog='/usr/lib/sendmail -t';
$i=0;
#打开邮件列表文件.
open (FILE, "email.txt");
@file=;
close (FILE);
#分解邮件列表成名字和地址.
foreach $file_line(@file)
{ ($name, $emailaddress)=split(/\|/, $file_line);
&sendpass;
}
#发信
sub sendpass {
open (MAIL,"| $mailprog") || die "Mail system error";
print MAIL "to: $emailaddress";
print MAIL "Subject: 标题换成自己的\n";
print MAIL "From: xxx\@hotmail.com\ |
|