Answers
Sep 04, 2006 - 05:38 PM
Bcc is set by adding something like this to the additional headers parameter:
"Bcc: copyme@example.com\r\n"
This should work from PHP 4.3 onwards.
"Bcc: copyme@example.com\r\n"
This should work from PHP 4.3 onwards.
Sep 05, 2006 - 07:36 AM
If you don't feel like writing the headers yourself, you might find it easy to use the PHPMailer class. It's quite professional and allows cc, bcc, multiple addresses, smtp authentication, attachments and so on.
You will need to download the classes from http://phpmailer.sourceforge.net/ and then use some code like this :
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // send via SMTP
$mail->Host = "smtp1.site.com;smtp2.site.com"; // SMTP servers
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "jswan"; // SMTP username
$mail->Password = "secret"; // SMTP password
$mail->From = "from@email.com";
$mail->FromName = "Mailer";
$mail->AddAddress("josh@site.com","Josh Adams");
$mail->addBCC("joe@site.com","Joe Tailer");
$mail->Subject = "Here is the subject";
$mail->Body = "This is the body";
if(!$mail->Send())
{
echo "Message was not sent
You will need to download the classes from http://phpmailer.sourceforge.net/ and then use some code like this :
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // send via SMTP
$mail->Host = "smtp1.site.com;smtp2.site.com"; // SMTP servers
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "jswan"; // SMTP username
$mail->Password = "secret"; // SMTP password
$mail->From = "from@email.com";
$mail->FromName = "Mailer";
$mail->AddAddress("josh@site.com","Josh Adams");
$mail->addBCC("joe@site.com","Joe Tailer");
$mail->Subject = "Here is the subject";
$mail->Body = "This is the body";
if(!$mail->Send())
{
echo "Message was not sent
";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
Sep 05, 2006 - 07:52 AM
thanks a lot, that's a great help.
Especially the phpmailer class makes things easier for me. Thanks for the example, redcharcoal.
Especially the phpmailer class makes things easier for me. Thanks for the example, redcharcoal.
Jun 23, 2008 - 10:56 PM
AddBCC will work only on Win32 :(
Add New Comment