Re: mail() Bcc:

From: Date: Mon, 24 Mar 2003 22:51:03 +0000
Subject: Re: mail() Bcc:
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-140901@lists.php.net to get a copy of this message
> > 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...

« previous php.general (#140901) next »