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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
diarmuid
Forum Newbie
Posts: 1
Joined: Sat Feb 23, 2008 6:28 am

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

Post 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.";
}
 
?>
francisjeffy
Forum Newbie
Posts: 17
Joined: Fri Feb 29, 2008 12:10 pm

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

Post 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
Post Reply