PDA

View Full Version : send for tutorial


loadie
11-03-2013, 11:54 AM
OK, pulling my hair out now.
I have been using Ramandeeps tutorial "using dreamweaver and PHP to send form results in an email" for ages on the wifes website and it works great. Now she wants me to add a "bcc" email address.
I have tried all sorts of code tweaks obtained from google but each time the code fails until I change it back to the original.
Can anyone guide me in the right direction?? Have attached the code below for ease.

Thanks
loadie


<?php
//--------------------------Set these paramaters--------------------------

// Subject of email sent to you.
$subject = 'Results from Contact form';

// Your email address. This is where the form information will be sent.
$emailadd = 'mail@rdsnetworks.net';

// Where to redirect after form is processed.
$url = 'http://www.rdsnetworks.net/confirmation.html';

// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '0';

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>

edbr
11-04-2013, 01:29 AM
if you want a true bcc, a quick down and dirty way would be to add an extra mail()
first
$emailadd2 = 'mail2@rdsnetworks.net'; //bcc address


than modify
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');


to
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
mail($emailadd2, $subject, $text, 'From: '.$emailadd.'');

loadie
11-04-2013, 01:59 PM
Proper job! Brilliant

thanks
loadie:D