Jump to content


mail from webpage want to customise the from field.

  • Please log in to reply
1 reply to this topic

#1 mojito

  • Members
  • PipPipPip
  • Advanced Member
  • 74 posts

Posted 23 June 2006 - 05:30 PM

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

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.");

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.

#2 shortj75

  • Members
  • PipPipPip
  • Advanced Member
  • 118 posts
  • LocationPort Huron,mi

Posted 23 June 2006 - 05:49 PM

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
The Short One

hopfully this helps if it doesn't sorry
i won't write the code for you!!! you don't learn that way

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users