Hi, i am not too savvy, but i think you could do this in PHP or in Postfix.
My guess is, if you know what the "returndomain" is from using PHP code you could add it to the transport file maybe, and run postmap to update transport file ? I assume you are pulling the "returndomain" from your PHP code to find it in the first place, if so can you just write code to insert it where you want when calling the mail(x,y,...) function ? Is this the type of code you are doing as an example ? $body="Hello ". $row['First_N']."\n\nPlease remember you have the following appointment scheduled for today.\n\nDate: $month/$day/$year \nTime: $time $showroom \nWith: ".$row['F_Name']." ". $row['L_Name']."\n\nFor more details on your appointment or to cancel your appointment, please go to the link below.\n\nhttp://uconn.edu/secure_per/index.php"; $from = "[email protected]<mailto:[email protected]>"; $headers = "From: $from"; //*********************** //PREPARE EMAIL HEADER $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); //SEND EMAIL $mail = $smtp->send($to, $headers, $body); //THIS APPEARS TO CHECK FOR ERRORS IN THE EMAIL BEING SENT if (PEAR::isError($mail)) { $failed++; } else { $success++; } //*********************** //mail($to,$subject,$body,$headers); //echo "<P>$message</P>"; $i++; Not sure i am any help or confusing the matter, you let me know. -ALF ________________________________ From: [email protected] <[email protected]> on behalf of certified <[email protected]> Sent: Tuesday, October 10, 2017 3:23 PM To: [email protected] Subject: Sending with Multiple Domain Suffixes from Single Apache Server Box How do I configure postfix to append the correct domain on outgoing emails from php on apache: I have LAMP on Centos 7 and a static IP. There are several domain names registered to that static IP: first.com -> my static ip another.com -> my static ip third.com -> my static ip My postfix MX server is also on the webserver box. php uses the following format: $result = mail($to, $subject, $message, $headers, "-f returndomain") So how do I configure postfix to append the correct domain on outgoing emails: if returndomain is first.com, I would like postfix to send it with the virtual [email protected] from addy if returndomain is another.com, I would like postfix to send it with the virtual [email protected] from addy Details: 1. I need to send confirmation emails using php on apache to people registering for my services from the internet 2. I need to have the correct domain suffix and return path added to the sender's email: [email protected] sending from /var/www/html/first/ needs the email headers all consistent with mail sent from first.com [email protected] sending from /var/www/html/another needs mail sent from [email protected] 3. these emails go TO pretty much anywhere - google, yahoo - anywhere visitors request confirmation to go 4. these emails come FROM my MX on the webserver DIRECTLY to their email addy, not relayed thru google etc. 5. the machine hostname isn't any of the above domain names, it is simply somehost Apache sends first.com requests to /var/www/html/first/ using DocumentRoot "/var/www/html/first/" Apache sends another.com requests to /var/www/html/first/ using DocumentRoot "/var/www/html/another/" obviously the user and group will be apache:apache So how do I configure postfix to append the correct domain on outgoing emails: if returndomain is first.com, I would like postfix to send it with the virtual [email protected] from addy if returndomain is another.com, I would like postfix to send it with the virtual [email protected] from addy Note that I don't want to receive email on my MX. -- Sent from: http://postfix.1071664.n5.nabble.com/Postfix-Users-f2.html
