使用sendmail发送邮件

一、Linux命令

echo "Subject: test" | /usr/sbin/sendmail -v you@domain.com

二、PHP

<?php
$fd = popen("/usr/sbin/sendmail -t","w") or die("Couldn't Open Sendmail");
fputs($fd, "To: me@mydomain.com \n");
fputs($fd, "From: \"Your Name\" <you@domain.com> \n");
fputs($fd, "Subject: Test message from my web site \n");
fputs($fd, "X-Mailer: PHP3 \n\n");
fputs($fd, "Testing. \n");
pclose($fd);
?>

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>