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

    0
     
    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

    0
     
    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
     
  3. gtowle

    gtowle Guest

    0
     
    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 = "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:
    	------------------------------
    	$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;
    } //
    
    ?>
    
     
Loading...