17 July 2020

How to send email after saving post in wordpress?

Send email after saving post in wordpress



function action_publish_post( $ID, $post ) { 
$contactfirstname ="Jassi";

// No need to make changes below this line.
 $toadmin = "developwithjaspreet@gmail.com";

$adminmessage = 'You just got one visitor. Here is the detail below';
$noreply = 'noreply@jaspreet797386@gmail.com';
$headers = "From: " . $contactfirstname . "\r\n";
            $headers .= "Reply-To: ". strip_tags($noreply) . "\r\n";
            $headers .= "MIME-Version: 1.0\r\n";
            $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$headers = 'From: "' . $contactfirstname . '" <no-reply@randhirstudsios.com>' . "\r\n";
wp_mail( $toadmin, $contactfirstname, $adminmessage, $headers );
}         
// add the action 
add_action( 'publish_contracts', 'action_publish_post', 10, 2 ); 


No comments:

Post a Comment

How to add re-captcha v3 on all Elementor forms using coding?

 Add re-captcha v3 on all Elementor forms using coding add_action('wp_footer',function(){     ?> <script src="https://www...