473,657 Members | 2,513 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.

Regards

N.Prabhu
Nov 10 '06 #1
4 67611
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.c om";
$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.c om";
$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\htdoc s\testsendemail \index.php


here is the code that i downloaded:

<?php

//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>";
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\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
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 one please help. Thanks, mashraf
6
5060
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;
4
3789
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
2130
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:"
3
3025
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....
1
1286
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"
2
1549
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>
3
3114
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
1
6836
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...
4
1492
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;
0
8421
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, 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...
0
8325
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8844
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, 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...
1
8518
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,...
0
8621
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 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...
0
7354
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6177
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1734
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 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.