473,473 Members | 2,207 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Difficulty in adding BCC/CC headers in php

8 New Member
Hi all,
Please i am having difficulty in adding BCC and CC headers to my email script.i want all inputs to be from the html form i.e the script calling what users enter from a form like this

To:
From:
CC:
BCC:
Subject:
Message:

Thanks....
Aug 29 '09 #1
3 2353
Markus
6,050 Recognized Expert Expert
You would send that information through the headers string (4th parameter of mail()). However, who uses the mail() function these days? Use SwiftMailer, as it makes sending mail with cc and bcc, among other things, very easy.

Mark.
Aug 29 '09 #2
BenKen
8 New Member
Thanks Marcus but its somewhat different,this is my syntax and form below but instead of 'to' variable going to the email specified in the syntax,i want that input to come from the form including cc and bcc.i do not want anything to be entered through the syntax all should come through the form i.e form having additional fields(to,cc and bcc).cheers
Expand|Select|Wrap|Line Numbers
  1. <form name="contact" action="send.php" method="POST">
  2.  
  3.    <label>From:</label> <input type="text" name="email" /><br />
  4.    <label>Subject:</label> <input type="text" name="subject" /><br />
  5.    <label>Message:</label> <textarea name="body"></textarea><br />
  6.    <input type="submit" name="Submit" value="Submit" />
  7.  
  8. </form>
  9. Send.php
  10. <?php
  11.    $to = "me@mydomain.com";
  12.    $from = $_POST['email'];
  13.    $subject = $_POST['subject'];
  14.    $body = $_POST['body'];
  15.  
  16.    $headers = "From: $from\r\n";
  17.    $headers .= "Reply-to: $from\r\n";
  18.  
  19.    // send mail
  20.    if (mail($to,$subject,$body,$headers)){
  21.      echo "Message sent successfully";
  22.    }else{
  23.      echo "Error: Sending your message failed";
  24.    }
  25. ?>
Aug 29 '09 #3
Markus
6,050 Recognized Expert Expert
Yes, and you can still obtain those values via the $_POST or $_GET array.

Expand|Select|Wrap|Line Numbers
  1. $recipients->addBcc($_POST['bcc']);
  2.  
Mark.
Aug 29 '09 #4

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

Similar topics

0
by: Cybermedia Marketing | last post by:
I'm trying to convert an ISAPI filter to an httpmodule. The ISAPI filter added custom headers to the response which could later be accessed by the asp page. ISAPI Filter: ...
1
by: Ale News | last post by:
Hi to All.. I must add some custom headers HTTP and then i would to read them.. I used the AppendHeader Method to add my headers but when i try to read the headers i can't see my custom ones.....
0
by: Stephen Hynds | last post by:
Hi, I'm writing a VB app that sends mail to a number of users when an important deadline is approaching. I can get the mail to show up as high priority and I can even get it to have a follow up...
4
by: razvan | last post by:
I need advice about adding security to a web service without using WSE, as the clients will run Win98.
1
by: asnowfall | last post by:
I am creating MailMessage out of already existing email message. My existing message has few custom properties. I wan to add them to System.Net.Mail.MailMessage How to add custom properties? ...
0
by: Sanjaya | last post by:
Hi, I need to add application specific headers and reference parameter in the "ReplyTo" to my web service request as header elements. What is right way to do this? I'm using framework 1.1 with...
1
by: lmawler | last post by:
Hi, I am trying to make a report which groups together parents and their children. I have three levels. I currently have three group headings and one detail section. I have some fields that...
0
by: Nithi Gurusamy | last post by:
I have generated a Web-Service-Proxy (Add Web Reference) within VS. This proxy class is based on WebServicesClientProtocol of WSE 3.0. I want to add some custom HTTP Headers to the envelop before...
0
by: msnews.microsoft.com | last post by:
Hi, I need to create and add custom headers to an ASP.NET 2.0 application. The case is simulation of an SSO-login in our dev/test environment. When I try to add headers I run into the "Not...
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
jinu1996
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...
0
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
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
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.