avatar
t*g
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

avatar
i*l
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?
avatar
t*g
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\
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。