Categories

Friday, March 29, 2024
#919814419350 therichposts@gmail.com
WordpressWordpress Tricks

Send Email in WordPress working example

How to add custom meta title and meta description in Wordpress?

Hello to all, welcome to therichpost.com. In this post, I will show you, Send Email in WordPress working example.

If you are new in WordPress, then you can check my old WordPress post and WordPress tricks to get some knowledge of WordPress.

I personally like wordpress very much and I do my mostly work in WordPress.

Here is the working code for Send Email in WordPress working example and please follow it carefully:

<?php
   //Mail Function
   $to        = 'YourEmailId.com';
   $subject   = "Wordpress Test Email";
   $headers   = 'Content-type: text/html;charset=utf-8' . "\r\n".'From: '. $_POST['request_email'] . "\r\n" .
   'Reply-To: ' . $_POST['request_email'] . "\r\n";
   
   $message = "Name = ".$_POST['request_name'];
   $message .= "<br />Phone =".$_POST['request_phone'];
   $message .= "<br />Email =".$_POST['request_email'];
   $message .= "<br />Comment =".$_POST['request_comment'];
   
  //Here put your Validation and send mail
   $sent = wp_mail($to, $subject, $message, $headers);
     if($sent) {
       echo "Mail Sent";
     }
     else  {
       echo "Mail did not send";
   }       
 ?>

 

If you have any query related to this post then please do comment below.

Harjas,

Thank you

therichpost
the authortherichpost
Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 14, Angular 15, Angular 16, Angular 17, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.