*** Jeff escribió/wrote (Thu, 24 Jul 2008 09:27:37 -0400):
> I see that you can add headers, and these days it is essential to have a
> real "from".
>
> But I see you can also do this:
>
> mail('nobody@example.com', 'the subject', 'the message', null,
> '-fwebmaster@example.com');
>
> Does that only work with sendmail and how can you tell what the MTA
> (is that right) is?
If I'm not wrong, it works with Sendmail *and* Sendmail-compatible MTAs
such as Postfix or Qmail. But you must be aware that -f sets the
Return-Path address, not the From header: they're different things.
> Also, how would you include a BCC or Reply To with that?
These are regular headers: just append them to the fourth parameter of
mail():
mail('nobody@example.com', 'the subject', 'the message',
"From:
webmaster@example.com\nBcc:
foo@example.com\nReply-To:
bar@example.com',
'-fwebmaster@example.com');
> On a related note, what's with CR LF I see in the examples. I see there
> are some issues with the CR, can I simple do this?:
>
> $header=<<<'thisdata'
> From: some_from
> BCC: some blind copy
> thisdata;
>
> and expect that to work?
Short answer: yes. Specs say that e-mail should use \r\n but \n tends to
work in practice and I've even seen \r\n failing some times...
Just be careful with $header; if extra line feeds get added, headers will
jump to the message body.
--
--
http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web:
http://bits.demogracia.com
-- Mi web de humor en cubitos:
http://www.demogracia.com
--