The From: address that you specify in PHP's mail() is the from address
that appears in the mail's headers, but it's not the only from address
in an email message. The other one is the envelope sender address
specified within the SMTP communication itself which can be
different. And with php mail() will almost certainly be different.
If you're on a Windows server, then one solution is to simply to add
something like:
ini_set('sendmail_from', 'birt...@example.com');
before the call to mail() or to otherwise configure php.ini with the
same. This sets the envelope sender.
On some linux/*ix servers you can simply add an additional argument to
PHP mail() to specify options to sendmail to set the envelope sender,
for example:
mail($to, $subject, $message, $headers, "-f birt...@wxample.com");
however, overriding the envelope sender in this way requires
permission that won't necessarily have.
The most generic option (and therefore recommended way) is to use
something like Zend_Mail and use SMTP transport. There are many PHP
SMTP mail options out there, find one that best suits your
environment. Most of them will make it much easier to send attachments
too. You generally don't have to worry about the envelope sender at
all when using these packages.
If you're stuck, i have a php mail() replacement around that uses SMTP
and works exactly like PHP mail().
-Craig
On 19/05/2009, at 5:54 PM, henson wrote:
What's the IP address of the mail server?
Michael
But you didn't say why it's not working -- mail isn't being sent at
all or just not being sent to yahoo?
-Craig
On 20/05/2009, at 7:51 PM, henson wrote:
> I tried out putting 'localhost' as the SMTP server and it didn't work.
>