Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 05-12-2008, 08:16 PM BCC email issue
RNPoo7's Avatar
Extreme Talker

Posts: 238
Trades: 0
Hey guys,
I'm trying to figure out how to add a BCC to my email form.

Can someone help me out?

PHP Code:
<?php

$where_form_is
="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

session_start();
if( (
$_SESSION['security_code']==$_POST['security_code']) && (!empty($_POST['security_code'])) ) { 
mail("myemail@email.com","2008 MACYAC Registration","Form data:

First Name: " 
$_POST['field_1'] . 
Last Name: " 
$_POST['field_2'] . 
Email address: " 
$_POST['field_3'] . 
Phone Number: " 
$_POST['field_4'] . 
Address : " 
$_POST['field_5'] . 
City: " 
$_POST['field_6'] . 
State : " 
$_POST['field_7'] . 
Zip Code: " 
$_POST['field_8'] . 
Birthdate: " 
$_POST['field_9'] . 
Shirt Size : " 
$_POST['field_10'] . 
Roommate Preference 1: " 
$_POST['field_11'] . 
Roommate Preference 2: " 
$_POST['field_12'] . 
Your Church: " 
$_POST['field_13'] . 
Other Church: " 
$_POST['field_14'] . 
Emergency Contact : " 
$_POST['field_15'] . 
Emergency Phone Number: " 
$_POST['field_16'] . 
Insurance Company: " 
$_POST['field_17'] . 
Insurance Policy ID: " 
$_POST['field_18'] . 



"
);

include(
"confirm.html");
}
else {
echo 
"Invalid Captcha String.";
}

?>
__________________
I work on Turbo'd Honda's for fun :)

Last edited by RNPoo7; 05-12-2008 at 08:18 PM..
RNPoo7 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-12-2008, 08:26 PM Re: BCC email issue
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
Search for "BCC" on http://us.php.net/manual/en/function.mail.php . It's right there in an example (hint #4).
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 05-12-2008, 08:35 PM Re: BCC email issue
RNPoo7's Avatar
Extreme Talker

Posts: 238
Trades: 0
I've been googling it the past hour and from what I understand, I need to add this line:

PHP Code:
$headers .= 'Bcc: birthdaycheck@example.com' "\r\n"
But I'm not sure where.
__________________
I work on Turbo'd Honda's for fun :)
RNPoo7 is offline
Reply With Quote
View Public Profile
 
Old 05-12-2008, 10:20 PM Re: BCC email issue
RNPoo7's Avatar
Extreme Talker

Posts: 238
Trades: 0
Do i put the header after the "message"?
__________________
I work on Turbo'd Honda's for fun :)
RNPoo7 is offline
Reply With Quote
View Public Profile
 
Old 05-13-2008, 06:47 PM Re: BCC email issue
RNPoo7's Avatar
Extreme Talker

Posts: 238
Trades: 0
anyone?
__________________
I work on Turbo'd Honda's for fun :)
RNPoo7 is offline
Reply With Quote
View Public Profile
 
Old 05-13-2008, 11:39 PM Re: BCC email issue
Inet411's Avatar
Skilled Talker

Posts: 88
Name: programmer
Location: internet
Trades: 0
mail($to,$subject,$message, $headers);
__________________

Please login or register to view this content. Registration is FREE

Inet411 is offline
Reply With Quote
View Public Profile Visit Inet411's homepage!
 
Old 05-14-2008, 08:55 AM Re: BCC email issue
RNPoo7's Avatar
Extreme Talker

Posts: 238
Trades: 0
How would I use this with the code above? I think it's done a little differently.
__________________
I work on Turbo'd Honda's for fun :)
RNPoo7 is offline
Reply With Quote
View Public Profile
 
Old 05-14-2008, 09:13 AM Re: BCC email issue
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Quote:
How would I use this with the code above? I think it's done a little differently.
Nope.
Your problem might be that you use a "physical" return, rather than an explicit \r\n to spearate your headers.
And for your question, simply add the BCC in the headers, before the mail body. Usually near the To: or From:
http://www.php.net/manual/en/function.mail.php
Quote:
Description

bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
Quote:
additional_headers (optional) String to be inserted at the end of the email header.
This is typically used to add extra headers (From, Cc, and Bcc). Multiple extra headers should be separated with a CRLF (\r\n).
Note: When sending mail, the mail must contain a From header. This can be set with the additional_headers parameter, or a default can be set in php.ini.
Failing to do this will result in an error message similar to Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing. The From header sets also Return-Path under Windows.

Note: If messages are not received, try using a LF (\n) only. Some poor quality Unix mail transfer agents replace LF by CRLF automatically (which leads to doubling CR if CRLF is used). This should be a last resort, as it does not comply with » RFC 2822.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Reply     « Reply to BCC email issue
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.27185 seconds with 12 queries