/    Sign up×
Community /Pin to ProfileBookmark

carbon copy php?

I have implemented pyro’s script and I am still waiting
for an email carbon copy to arrive at my second email.

Could somebody please show me where I am going wrong?

Here is the php codes

<?PHP

##################################################

#####

# This script is Copyright 2003, Infinity Web Design #


# Distributed by <a href=”http://www.webdevfaqs.com” target=”_blank”>[url]http://www.webdevfaqs.com[/url]</a> #


# Written by Ryan Brill – [email][email protected][/email] #


# All Rights Reserved – Do not remove this notice #

##################################################

#####

## The lines below need to be edited…

###################### Set up the following variables ######################

#

$to = “[email protected]“; #set address to send form to
$subject = “Results from your web form.”; #set the subject line
$headers = “From: Form mail Reminder <[email protected]>n”;
$headers .= “Cc: [email][email protected][/email]rn”;
$forward = 0; # redirect? 1 : yes || 0 : no
$location = “thanks.php”; #set page to redirect to, if 1 is above

#

##################### No need to edit below this line ######################

## set up the time ##

$date = date (“l, F jS, Y”);
$time = date (“h:i A”);

## mail the message ##

$msg = “Below is the result of your feedback form. It was submitted on $date at $time.nn”;
$msg .= “IP: “.$_SERVER[‘REMOTE_ADDR’].”nn”;

if ($_SERVER[‘REQUEST_METHOD’] == “POST”) {
foreach ($_
POST as $key => $value) {
$msg .= ucfirst ($key) .” : “. $value . “n”;
}
}
else {
foreach ($_GET as $key => $value) {
$msg .= ucfirst ($key) .” : “. $value . “n”;
}
}

mail($to, $subject, $msg, $headers);
if ($forward == 1) {
header (“Location:$location”);
}
else {
echo “Thank you for submitting our form. We will get back to you as soon as possible.”;
}

?>

Any help would be greatly appreciated

to post a comment
PHP

12 Comments(s)

Copy linkTweet thisAlerts:
@ShrineDesignsJun 25.2004 — see if this works:[code=php]<?php
$to = "[email protected]"; // set address to send form to
$subject = "Results from your web form."; // set the subject line
$forward = 0; // redirect? 1 : yes || 0 : no
$location = "thanks.php"; // set page to redirect to, if 1 is above

// date and time
$date = date ("l, F jS, Y");
$time = date ("h:i A");

// mail the message
$msg = "Below is the result of your feedback form. It was submitted on {$date} at {$time}.nnIP: {$_SERVER['REMOTE_ADDR']}nn";
$request = ($_SERVER['REQUEST_METHOD'] == 'POST') ? $_POST : $_GET;

foreach($request as $key => $value)
{
$key = ucfirst($key);
$msg .= "{$key}: {$value}n";
}
if(mail($to, $subject, $msg) == false)
{
exit("mail() function error.n");
}
if($forward == 1)
{
header("Location: {$location}");
}
else
{
echo "Thank you for submitting our form. We will get back to you as soon as possible.";
}
?>[/code]
Copy linkTweet thisAlerts:
@denauthorJun 25.2004 — thanks for your response

I am checking it out now.
Copy linkTweet thisAlerts:
@denauthorJun 25.2004 — Still only receiving form through one email no

carbon copy through second email

Could it be my email handler?
Copy linkTweet thisAlerts:
@ShrineDesignsJun 25.2004 — are you trying to send 2 emails at once???
Copy linkTweet thisAlerts:
@denauthorJun 25.2004 — I probably am I need a form submitted to two emails.

I have tried $to with commas between email addresses

I have tried $headers . with email address then /r/n

still it only sends to the $to but not to anything else.
Copy linkTweet thisAlerts:
@ShrineDesignsJun 25.2004 — ok, try this:[code=php]<?php
// email to...
$first = "[email protected]";
$second = "[email protected]";

$subject = "Results from your web form."; // set the subject line
$forward = 0; // redirect? 1 : yes || 0 : no
$location = "thanks.php"; // set page to redirect to, if 1 is above

// date and time
$date = date("l, F jS, Y");
$time = date("h:i A");

// mail the message
$message = "Below is the result of your feedback form. It was submitted on {$date} at {$time}.nnIP: {$_SERVER['REMOTE_ADDR']}nn";
$method = ($_SERVER['REQUEST_METHOD'] == 'POST') ? $_POST : $_GET;

foreach($method as $key => $value)
{
$key = ucfirst($key);
$message .= "{$key}: {$value}n";
}
mail($first, $subject, $message);

if($second != NULL)
{
mail($second, $subject, $message);
}
if($forward == 1)
{
header("Location: {$location}");
}
else
{
echo "Thank you for submitting our form. We will get back to you as soon as possible.";
}
?>[/code]
fixed! ?
Copy linkTweet thisAlerts:
@denauthorJun 25.2004 — It is showing this after submit.

Parse error: parse error, unexpected ')' in e:inetpubesvc001229nrdatamailer.php on line 27

PHP Parse error: parse error, unexpected ')' in e:inetpubesvc001229nrdatamailer.php on line 27
Copy linkTweet thisAlerts:
@ShrineDesignsJun 25.2004 — fixed it, sorry not thinking lol
Copy linkTweet thisAlerts:
@denauthorJun 25.2004 — You are a champion!!?

That is tops

Thanks a million ShrineDesigns.

could i trouble you for another query
Copy linkTweet thisAlerts:
@denauthorJun 25.2004 — If i need to add a third email in the future will it be something like

this?

<?php

// email to...

$first = "[email protected]";

$second = "[email protected]";

$third = "[email protected]";

$subject = "Results from your web form."; // set the subject line

$forward = 0; // redirect? 1 : yes || 0 : no

$location = "thanks.php"; // set page to redirect to, if 1 is above

// date and time

$date = date("l, F jS, Y");

$time = date("h:i A");

// mail the message

$message = "Below is the result of your feedback form. It was submitted on {$date} at {$time}.nnIP: {$_SERVER['REMOTE_ADDR']}nn";

$method = ($_
SERVER['REQUEST_METHOD'] == 'POST') ? $_POST : $_GET;

foreach($method as $key => $value)

{

$key = ucfirst($key);

$message .= "{$key}: {$value}n";

}

mail($first, $subject, $message);

if($second != NULL)

{

mail($second, $subject, $message);

}

if($forward == 1)

{

mail($third, $subject, $message);

}

if($forward == 1)

{

header("Location: {$location}");

}

else

{

echo "Thank you for submitting our form. We will get back to you as soon as possible.";

}
Copy linkTweet thisAlerts:
@ShrineDesignsJun 25.2004 — i would replaceif($forward == 1)
{
mail($third, $subject, $message);
}
withif($third != NULL)
{
mail($third, $subject, $message);
}
Copy linkTweet thisAlerts:
@denauthorJun 25.2004 — Thanks for that Shrine Designs I can see where I went wrong.
×

Success!

Help @den spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...