Formmail from tag


#1

How can I get my formmail to use a FROM address of my own choosing… .and not "nobody@ninja.sd.dreamhost.com"


#2

This really depends on the script that’s processing the mail request, as the script itself will specify it in the function that does the mailing.

You can write your own PHP script to do form mailing fairly easily, which will allow you to specify whatever you choose as the sender address - you can even allow users to submit their email address in the form as a form variable, and then use that as the sender address in the PHP mail() function. Here’s a quick example:

HTML:
Email:

PHP:
$email = $_POST[‘email’]; // Gets ‘email’ value from form above
$header = 'From: '.$email."\r\nContent-type: text/plain\r\nX-mailer: PHP/".phpversion(); // Sets up the header, with sender
mail($recipient, $subject, $bodytext, $header); // does the mailing