Jump to content


This topic is now archived and is closed to further replies.


mail from webpage want to customise the from field.

Recommended Posts

Hi Guys

Currently I have a contact form on a server which sends a message to the website owner, a simple contact form. I would like the from field to contain the email from the form which the user submits.

I have

[code]mail("freaks@aol.com", "bit of text", $message2, "From: \"$name\" <$email>\$email") or die(" \n There was some error sending the mail please contact me via email directly freaks@aol.com , sorry for the inconvienience.");[/code]

this works but the from field must be being overidden from the server as it puts its own server stamp in there.

Am i using mail(); wrong?

I just saw this on php site

If you try to set "From:" e-mail header value under Windows when it is already defined in php.ini "sendmail_from" value, this will doesn't work. If you still want to customize this value, then you must use another option like XPertMailer ( [a href=\"http://www.xpertmailer.com/\" target=\"_blank\"]http://www.xpertmailer.com/[/a] ) to send the e-mail directly to the client SMTP server or use a relay SMTP server with authentification option.

Share this post

Link to post
Share on other sites
try something like this
here is the form

<form method=post action=sendemail.php>
<center><table cellpadding=0 cellspacing=0 class=contacttable><tH class=contacthead><center>Contact</CENTER>
<TR><TD>From: <input type=text name=email>
<TR><TD>Subject: <input type=text name=sub size=70>
<TR><TD>Message:<br />
<textarea name=mess cols=80 rows=10></textarea><BR />
<input type=submit name=submit value=send>


and here is the page that sends the email

$to = "freaks@aol.com";
$mess = $_POST['mess'];
$from="From: $_POST[email]";

$mail=mail("$to", "$sub", "$mess", "$from");
print "<center>Sorry Your E-mail Was Not Sent</center>";
print "<center>Your E-mail Was Sent Successfuly</center>";

this is the cantact form i have on my site and it works great

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.