473,395 Members | 1,653 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

how to send mail in php with bcc and cc?

hi all,

I am sending e-mail using php code as follows.

$sentOk = mail($to,$subject,$message,$headers);

It is working well. I tested.

Now i want to send mail to more addresses using 'bcc' and 'cc' options.

I need to complete this in php code as much as quickly.

Please help me.

Advance thanks.

Regards

N.Prabhu
Nov 10 '06 #1
4 67590
ronverdonk
4,258 Expert 4TB
Like this, put them in the $headers variable.

[php]
$headers = "From: me@mydomain.com";
$headers .= "\r\nCc: he@$hisdomain.com";
$headers .= "\r\nBcc: her@$herdomain\r\n\r\n";
$headers .= "\r\nX-Mailer: PHP/" . phpversion();
[/php]
Ronald :cool:
Nov 10 '06 #2
Like this, put them in the $headers variable.

[php]
$headers = "From: me@mydomain.com";
$headers .= "\r\nCc: he@$hisdomain.com";
$headers .= "\r\nBcc: her@$herdomain\r\n\r\n";
$headers .= "\r\nX-Mailer: PHP/" . phpversion();
[/php]
Ronald :cool:


Thanks.

It is working nice. We can send mails with bcc and cc.
Nov 17 '06 #3
j4uk3n
2
well i have a problem just by using mail function.
i downloaded this code from a tutorial website, and save it on

c:\apache\htdocs\testsendemail\index.php


here is the code that i downloaded:

<?php

//Check whether the submission is made
if(isset($hidSubmit)){

//Declarate the necessary variables
$mail_to=$txtEmailto;
$mail_from=$txtEmailfrm;
$mail_sub=$txtSub;
$mail_mesg=$txtMsg;

//Check for success/failure of delivery
if(mail($mail_to,$mail_sub,$mail_mesg,"From:$mail_ from/r/nReply-to:$mail_from"))
echo "<span class='textred'>E-mail has been sent successfully from $mail_sub to $mail_to</span>";
else
echo "<span class='textred'>Failed to send the E-mail from $mail_sub to $mail_to</span>";
}
?>

||||
||||
||||
||||
||||

this is the warning message that i received:

Warning: Failed to Connect in c:\apache\htdocs\testsendemail\index.php on line 13
Failed to send the E-mail from to


what should i do?
sorry i'm a total newbie here, just started to learn how to use php.

tQ in advance
Nov 22 '06 #4
ronverdonk
4,258 Expert 4TB
Have you defined the correct email settings in your PHP.INI? If you dont't know, show them.

Ronald :cool:
Nov 22 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: mashraf | last post by:
Hi, I am trying to send Mail from VB.net app but I can not do it. Even I can not do this = Imports system.mail, the mail option is not available. I also have to do more then one atachements. Some...
6
by: erdem kemer | last post by:
i cant send mail to yahoo mail or hotmail while i can send my other mail accounts (pop3) is it becouse yahoo and hotmail is web-based mail here is the code MailMessage mailMsg = new...
4
by: PawelR | last post by:
Hi, everbody. How send e-mail if smtp need authorization. If authorization is not required send email is not problem but I use SmtpMail.Send(myMail) PawelR
6
by: Retf | last post by:
Hi All, I need send e-mail through the form. I tried this: --------------------------------------------------- DateTime dt = DateTime.Now; String sMsg = "<p><font face='Verdana'...
3
by: RN | last post by:
I am tired of sending mail from the built-in SMTP service for so many reasons (errors are nondescriptive in the event log, it doesn't let me control which IP address it sends from, and it...
1
by: Max | last post by:
hi I used mailmessage object to send the mail, my smtp server don't require authentication, when i try to send the mail it shows error. following is the code to send mail. Dim mymail As New...
2
by: asp coding | last post by:
hi all i need to send mail in ASP but it should not be sent from server, when user clicks on send mail button then only it should send the mail. i tried to send the mail using server, code...
3
by: crossroadsk | last post by:
<pre> Hi all, I'm new to Javamail concept and i got the following exceptions when i tried to send a simple mail. First exception is : using java Could not connect to SMTP host:...
1
by: maxxxxel | last post by:
Hi Can anyone help me with some asp code , I changed the code to use CDO.message instead of the old cdont.sys to send mail from a ASP webpage which works fine. Our problem is that when we send...
4
by: pskvenkat | last post by:
Hello, This is venkat, I was trying to send the email using the following codes but error occurs everytime can you fix this. using System.Data; using System.Linq; using System.Web; using...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.