• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

PHP Mailform - How to change "from"

G

gtowle

Guest
I'm using a PHP mail form with Flash. All works fine, but I'm wondering if and how I can change the from email address so that the auto reply email comes from the client rather than from [email protected].

Haven't been able to find any solutions. Thanks.
 
This may help

I am still a bit of noob when it comes to this area - esp considering i can't get my forms to deliver at the moment, but in my search for why I did find this:

http://kb.odin.com/en/1251

It may be what you are looking for.

Lawrence
 
Lawrence-

That worked. Thanks. I wish I could help you with your issue-I'm not a pro either. Best I can do is provide you with the form that I am using (it links with Flash swf, though) which works fine with Plesk 8.2. Maybe you can compare and figure something out. Here it is and good luck.

Code:
<?  

$adminaddress = "[email protected]"; 
$siteaddress ="www.anydomain.com"; 
$sitename = "[YourName]"; 

//No need to change anything below ... 
// Gets the date and time from your server
$date = date("m/d/Y H:i:s");

// Gets the IP Address
if ($REMOTE_ADDR == "") $ip = "no ip";
else $ip = getHostByAddr($REMOTE_ADDR);

// Gets the POST Headers - the Flash variables
$action = $HTTP_POST_VARS['action'] ;
$email = $HTTP_POST_VARS['email'] ;
$firstname = $HTTP_POST_VARS['firstname'] ;
$name = $HTTP_POST_VARS['name'] ;
$company = $HTTP_POST_VARS['company'] ;
$city = $HTTP_POST_VARS['city'] ;
$comments = $HTTP_POST_VARS['comments'] ;
putenv ("QMAILUSER=yourname");
putenv ("[email protected]");
putenv ("QMAILHOST=anydomain.com");
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain;charset=us-ascii\r\n";
$headers .= "From: yourname<[email protected]>";

// Process the form data!
// and send the information collected in the Flash form to Your nominated email address

if ($action == "send") {
	//
	mail ("$adminaddress","Info Request",
	"A visitor at YourName has left the following information\n
	Firstname: $firstname 
	Name: $name
	Company: $company
	City: $city 
	Email: $email\n
	The visitor commented:
	------------------------------
	$comments
	
	------------------------------
	Date/Time:  $date") ; 
	
	//This sends a confirmation to your visitor
	mail ("$email","Thank You for visiting YourName", 
	"Hello $firstname $name,\n
	We have received your inquiry and will reply shortly.  Thank you for your interest in YourName.\n
	Sincerely,
	YourName" );
	
	
	
	//Confirmation is sent back to the Flash form that the process is complete
	$sendresult = "Thank you. You will receive a confirmation email shortly.";
	$send_answer = "answer=";
	$send_answer .= rawurlencode($sendresult);
	echo $send_answer;
} //

?>
 
Back
Top