I use the script below to send email:
-------------------------------BEGIN--------------------------------
<?php
$from_name = "Samuel Richards";
$from_email = "a@b.com";
$to_email = "c@d.com";
$subject = "Test Message";
$charset = "us-ascii ";
$body .= "Test body";
$MP = "/var/qmail/bin/sendmail -t";
$fd = popen($MP,"w");
fputs($fd, "Content-Type: text/html;");
fputs($fd, "charset=$charset\n");
fputs($fd, "To: $to_email\n");
fputs($fd, "From: $from_name\n");
fputs($fd, "Subject: $subject\n");
fputs($fd, "X-Mailer: Email server\n");
fputs($fd, $body);
pclose($fd);
-------------------------------END-----------------------------------
The problem is that when the email is delivered, the sender always defaults to
Samuel@mydomain.mydomain.com,
instead of
Samuel Richards
that is in the script.
If for example, $from_name is King Arthur Jr. II, the email will be delivered as
King@mydomain.mydomain.com
How can I change this behavior?
Thanks.
Richie.