473,836 Members | 2,150 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,$subje ct,$message,$he aders);

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.


Nov 10 '06 #1
4 67617
4,258 Recognized Expert Specialist
Like this, put them in the $headers variable.

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

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


It is working nice. We can send mails with bcc and cc.
Nov 17 '06 #3
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\htdoc s\testsendemail \index.php

here is the code that i downloaded:


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

//Declarate the necessary variables
$mail_to=$txtEm ailto;
$mail_from=$txt Emailfrm;
$mail_sub=$txtS ub;
$mail_mesg=$txt Msg;

//Check for success/failure of delivery
if(mail($mail_t o,$mail_sub,$ma il_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>";
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\htdoc s\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
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

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 one please help. Thanks, mashraf
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 MailMessage(); mailMsg.From = from; from = from + from;
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
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' size='1'>Trinity Systems - Comprar - Private Label Control - " + dt.Day + "/" + dt.Month + "/" + dt.Year + "</font></p>" + "<hr color='#C0C0C0' align='left' size='3'>" + "<br> Nome:"
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 identifies itself as the computer name which is not in domain.com format, triggering spam filter problems). Instead, I want to have my code send through an SMTP server of a company that we pay for mail service. But they require a username and password....
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 MailMessage Dim smtp As SmtpMail smtp.SmtpServer = "mailhost.gujarat.gov.in" mymail.To = "mahesh@cybersurfindia.com"
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 written was as follows <html> <title>mail</title> <body>
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: smtp.gmail.com, port: 25; Second Exception is : java.net.SocketException: Software caused connection abort: connect
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 mail externally to a internet email site like Gmail the PDF is sent but is corrupted because CDOSYS ends up using binary encoding rather than Base64 encoding when creating the attachment. More information here: Anthonys Code My knowledge of ASP...
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 System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls;
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.