# anth login, type your user name and password here
$smtp->auth('user','pass'); ###用户名和密码
foreach my $mailto (@mailto) {
# Send the From and Recipient for the mail servers that require it
$smtp->mail($mailfrom);
$smtp->to($mailto);
# Start the mail
$smtp->data();
# Send the header
$smtp->datasend("To: $mailto\n");
$smtp->datasend("From: $mailfrom\n");
$smtp->datasend("Subject: $subject\n");
$smtp->datasend("\n");
# Send the message
$smtp->datasend("$text\n\n");
# Send the termination string
$smtp->dataend();
}
$smtp->quit;
6、给sendmail执行权限
[root@CentOS ~]# chmod 755 /etc/init.d/sendmail.sh
7、测试
[root@CentOS ~]# /etc/init.d/sendmail.sh
8、嘿嘿,看看信发送了没有。
