WordPress mail functionality


if(isset($_POST[‘submit’])){

$name = $_POST[‘name_fil’];
$mail = $_POST[‘mail_fil’];
$web = $_POST[‘web_fil’];
$msg = $_POST[‘msg_fil’];
if($name==”” || $mail==”” || $web==”” || $msg==””){
$mess = ‘<span style=”color: #c00;”>All (*) fields are required</span>’;
}else{
$message .= ‘Name: ‘.$name;
$message .= ‘<br>’;
$message .= ‘E-Mail: ‘.$mail;
$message .= ‘<br>’;
$message .= ‘Website: ‘.$web;
$message .= ‘<br>’;
$message .= ‘Message: ‘.$msg;
$headers .= “MIME-Version: 1.0\r\n”;
$headers .= “Content-Type: text/html; charset=ISO-8859-1\r\n”;
if(wp_mail(‘mail id’, “Contact Us”, $message, $headers)){
$mess = ‘<span style=”color: #20B217;”>Mail sent successfully</span>’;
}

}

echo $mess;

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s