WordPress mail functionality


$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>’;
$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;


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 )

Facebook photo

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

Connecting to %s