1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

PHP Mailform - How to change "from"

Discussion in 'Plesk for Linux - 8.x and Older' started by gtowle, Apr 20, 2008.

  1. gtowle

    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 root@ac.mydomain.com.

    Haven't been able to find any solutions. Thanks.
  2. lawrencebrown

    lawrencebrown Guest

    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:


    It may be what you are looking for.

  3. gtowle

    gtowle Guest


    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.

    $adminaddress = "yourname@anydomain.com"; 
    $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 ("QMAILNAME=yourname@anydomain.com");
    putenv ("QMAILHOST=anydomain.com");
    $headers = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/plain;charset=us-ascii\r\n";
    $headers .= "From: yourname<yourname@anydomain.com>";
    // 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:
    	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
    	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;
    } //