Thanks to everyone for their suggestions. Here's what I've figured out and
where I'm stuck:
I had my email domain listed in the "mydomains" line of main.cf. That's why
the mails were only being handled on my local machine and not going out to
the proper SMTP server. I took it out and was able to send a test message by
telneting into localhost. However, when I try to send a mail through PHP, it
gets rejected on the grounds of "unknown user account" on the server.
Further investigation reveals PHP is using www-data as it's user and, for
whatever reason, it's not using the name I specify in the $headers variable
of my PHP script... Here's the script I'm using:

$to="[email protected]";
$subject="Test";
$body="Testing";
$headers="From: [email protected]\r\nReply-to: [email protected]";

$mail_sent=@mail($to,$subject,$body,$headers);
echo $mail_sent ? "Message sent." : "Message failed.";

And here's the tail of mail.log:

Sep 26 18:10:26 pspicer-ubuntu postfix/pickup[26062]: 4039E849A7: uid=33
from=<www-data>
Sep 26 18:10:26 pspicer-ubuntu postfix/cleanup[27047]: 4039E849A7:
message-id=<20110926221026.4039E849A7@pspicer-ubuntu>
Sep 26 18:10:26 pspicer-ubuntu postfix/qmgr[26063]: 4039E849A7: from=<
[email protected]>, size=372, nrcpt=1 (queue active)
Sep 26 18:10:26 pspicer-ubuntu postfix/smtp[27049]: 4039E849A7: to=<
[email protected]>, relay=192.168.1.6[192.168.1.6]:25, delay=0.14,
delays=0.14/0.01/0/0, dsn=5.0.0, status=bounced (host
192.168.1.6[192.168.1.6] said: 573 [email protected] unknown user
account (in reply to MAIL FROM command))
Sep 26 18:10:26 pspicer-ubuntu postfix/cleanup[27047]: 622DC849A8:
message-id=<20110926221026.622DC849A8@pspicer-ubuntu>
Sep 26 18:10:26 pspicer-ubuntu postfix/qmgr[26063]: 622DC849A8: from=<>,
size=2236, nrcpt=1 (queue active)
Sep 26 18:10:26 pspicer-ubuntu postfix/bounce[27050]: 4039E849A7: sender
non-delivery notification: 622DC849A8
Sep 26 18:10:26 pspicer-ubuntu postfix/qmgr[26063]: 4039E849A7: removed
Sep 26 18:10:26 pspicer-ubuntu postfix/smtp[27049]: 622DC849A8: to=<
[email protected]>, relay=192.168.1.6[192.168.1.6]:25, delay=0.13,
delays=0.05/0/0/0.08, dsn=5.0.0, status=bounced (host
192.168.1.6[192.168.1.6] said: 550 [email protected] unknown user
account (in reply to RCPT TO command))
Sep 26 18:10:26 pspicer-ubuntu postfix/qmgr[26063]: 622DC849A8: removed

See where it says "from=<[email protected]> and not
[email protected] I specify in the script? Anyone have an idea
why? I'm still trying to
turn something up in Google...

Reply via email to