Skip to content Skip to sidebar Skip to footer

Auto Email Responding

I'm using the below code to submit form information to my email account but i also want it to send a confirmation email to the sender. I like to add this message for automatic resp

Solution 1:

You need to append below code at bottom to send email to the sender as well.

// Email to Sender (Without HTML/CSS)

$sender_email = $email;
$admin_email = 'mrvn.acosta@gmail.com';

$message = "Thanks for your interest".$name."\n\n";

$message .= "This is just a quick note to let you know we have received your 
form and will respond as soon as we can.\n\n";

$message .= "Best,\n\n";
$message .= "Marvin\n\n";

mb_language("Japanese");
mb_internal_encoding("UTF-8");
$success2 = mb_send_mail($sender_email, 'Thanks', $message, 'From: 
<'.$admin_email.'>');


// Email to Sender (With HTML/CSS)

$sender_email = $email;
$admin_email = 'mrvn.acosta@gmail.com';

$header = "From: ".$admin_email." \n";
$header.= "Content-Type: text/html; charset=iso-8859-1\n";

$message = '<html><head><styletype="text/css">
            <!--
                .style2 {
                font-size: 11px;
                font-weight: bold;
                text-decoration: none;
                font-family: Verdana, Arial, Helvetica, sans-serif;
                color:#666666;

                }
                .style3 {
                text-decoration: none;
                font-family: Verdana, Arial, Helvetica, sans-serif;
                font-size: 11px;
                color:#666666;
                }
                -->
        </style></head><body><tablewidth="600"border="0"align="center"style="border:#EFEFEF 
5px solid; padding:5px; font-family:Arial, Helvetica, sans-serif; font-
size:11px; color:#666666"><tr><td><tablewidth="100%"border="0"cellpadding="2"cellspacing="6"><tr><tdclass="style3">Thanks for your interest 
'.$name.'</td></tr><tr><td>&nbsp;</td></tr><tr><tdclass="style3">This is just a quick note to 
let you know we have received your 
form and will respond as soon as we can.</td></tr><tr><td>&nbsp;</td></tr><tr><tdclass="style3">Best,<br>
                                Marvin
                            </td></tr></table></td></tr></table></body></html>';

mb_language("Japanese");
mb_internal_encoding("UTF-8");
$success2 = mb_send_mail($sender_email, 'Thanks', $message, $header);

Hope it helps!

Post a Comment for "Auto Email Responding"