473,505 Members | 16,800 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to send mail in php with bcc and cc?

10 New Member
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 67600
ronverdonk
4,258 Recognized Expert Specialist
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
prabhunew2005
10 New Member
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 New Member
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 Recognized Expert Specialist
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
376
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
5048
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
3783
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
2112
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
3006
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
1223
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
1539
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
3096
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
6818
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
1479
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
7103
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
7307
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7478
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...
0
5614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5035
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
755
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
409
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.