I've been getting "data format errors" from Sendmail when trying to send
automatic e-mails from my websites recently, and as I can't find a fix for
this, I tried some code that someone sent to me which actually worked. It
uses popen() and I'd like to know if this method of sending e-mail has any
major drawbacks over using the PHP mail() command (which doesn't work for me
anymore). Here's the code:

--------

$messg = "Here we put the content of the message.";
$sender = "[EMAIL PROTECTED]";
$sendmail = "/usr/sbin/sendmail -t -f $sender";
$body = "This is a test.";

$fd = popen($sendmail, "w");
fputs($fd, "To: [EMAIL PROTECTED]");
fputs($fd, "From: \"Sender Name\" <$sender>\r\n");
fputs($fd, "Subject: Finally\r\n");
fputs($fd, "X-Mailer: Mailer Name\r\n\r\n");
fputs($fd, $body);
pclose($fd);

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to