Generate a auto response email using PHP that is from email@example.com
Posted on 2014-03-31
Hi PHP developers
I have a script that is part of my contact page on my web site. Basically the script sends a email to hosted mail box then forwards the email to a distribution group on a exchange server as shown below:
$emailBody = "Name: ".$name."\nEmail: ".$email."\nPhone: ".$phone."\n\nMessage: \n\n".$message."\n";
$headers = 'From: firstname.lastname@example.org' . "\r\n" .
'Reply-To: email@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail('firstname.lastname@example.org', 'Email from Website', $emailBody, $headers);
What I would like to do is by pass the hosted server and delivery directly to exchange 2010 mailbox which has forwarding setup to a distribution group all ready setup on the exchange server.
I have created the mailbox email@example.com and forwarding to the distribution group but what I would really like is the php script to send a No-reply email back to the sender thanking them etc maybe a link for more help.
Anyone got any ideas on the best way to achieve this?
In addition would I need to create a spf record to achieve this?