Page 1 of 1

When i sent my form mail to an email address in outlook exp

Posted: Sat Feb 23, 2008 6:51 am
by diarmuid
When i sent my form mail to an email address in outlook express. It sent the mail ok but in the from header it inserts nobody@dddd.com nobody being the name for the server. can i put a header in my code to insert the senders email that can be picked up in the form email textfield. My code is as follows. Thanaks in advance.

Code: Select all

<?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("registeration@clubrubicon.ie","Online Registeration","Form data:
 
Firstname: " . $_POST['field_1'] . " 
Surname: " . $_POST['field_2'] . " 
Mobile: " . $_POST['field_3'] . " 
E-Mail: " . $_POST['field_4'] . " 
Tournament: " . $_POST['field_5'] . " 
Date: " . $_POST['field_6'] . " 
 
");
 
include("confirm.html");
}
else {
echo "Invalid Captcha String.";
}
 
?>

Re: When i sent my form mail to an email address in outlook exp

Posted: Thu Mar 06, 2008 3:18 pm
by francisjeffy
Hi,

You can add a header to the mail, like given below

Code: Select all

$from = name@mail.com;
$headers  = 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";
$headers .= 'From: ' .$from.'."\n";
 
Hope that helps,

Kind Regards,

jeF