Re: mail() Bcc:
| From: | Kevin Stone | Date: | Mon, 24 Mar 2003 23:24:05 +0000 |
| Subject: | Re: mail() Bcc: | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-140904@lists.php.net to get a copy of this message | ||
----- Original Message -----
From: "Kevin Stone" <kevin@helpelf.com>
To: <php-general@lists.php.net>
Sent: Monday, March 24, 2003 4:17 PM
Subject: Re: [PHP] mail() Bcc:
>
> ----- Original Message -----
> From: "CPT John W. Holmes" <holmes072000@charter.net>
> To: "Kevin Stone" <kevin@helpelf.com>; "Oden Odenius"
> <oden_php@hotmail.com>; <php-general@lists.php.net>
> Sent: Monday, March 24, 2003 3:51 PM
> Subject: Re: [PHP] mail() Bcc:
>
>
> > > > How can send bcc: with mail()?
> > > >
> > > From, CC and BCC are headers to be set in the fourth parameter of the
> > mail()
> > > function. Headers must be spearated by end-of-line characters.
> > >
> > > $headers = "From: me@mydomain.com\r\n
> > > CC: you@yourdomain.com\r\n
> > > BCC: them@theirdomain.com";
> > >
> > > mail($to, $subject, $body, $headers);
> > >
> > > There are many other headers that you may find useful that are just as
> > easy
> > > to add through the mail() function.
> >
> > I don't think that'll work. The concept is right, but the way you are
> typing
> > it, you're actually adding in two line breaks between each header.
That's
> > going to cause your CC: and BCC: header to show up in the body of the
> > message because anything after two consecutive line breaks is considered
> the
> > body.
> >
> > You can do it like this:
> >
> > $headers = "From: me@mydomain.com\r\nCC: you@yourdomain.com\r\nBCC:
> > them@theirdomain.com";
> >
> > or
> >
> > $headers = "From: me@mydomain.com
> > CC: you@yourdomain.com
> > BCC: them@theirdomain.com";
> >
> > Also, you may want to check the regs on the capitalization of the
headers.
> > If I'm wrong, someone please let me know, but some servers may only
accept
> > Bcc: instead of bcc: or BCC:, etc... ?? Does anyone know if that
matters?
> If
> > it does, is it only dependant upon the sending SMTP server and not any
> > servers the message is sent through or the receiving server?
> >
> > Thanks.
> >
> > ---John Holmes...
>
> \r\n should be used (esspecially in email!) to be compatible with all
> operating systems. However there were mistakes in my example. Notedly
the
> string I supplied would break the header with superfulous \n end-of-line
> characters. The "safe" syntax would be..
>
> $headers = "From: me@mydomain.com\r\n";
> $headers .= "CC: you@yourdomain.com\r\n";
> $headers .= "BCC: theme@theirdomain.com\r\n";
>
> In one continuous line. I do believe headers are case insensitive.
>
> HTH,
> Kevin
Sorry John I wrote before I read. I misunderstood what you were correcting
me about. I see now that you nailed my mistake.
- Kevin