Skip to content

chamithkanchana/Wordpress_REST_API_PHPMailer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Wordpress_REST_API_PHPMailer

Send emails using PHPMailler and wordpress REST API endpoint.

Steps to follow

  1. Create a custom endpoint with POST request.
  2. Download PHPMailer (https://github.com/PHPMailer/PHPMailer) and upload it to your theme folder. Mine twenty nineteen.
  3. Create a folder inside your theme and add demo.html email template to it. The folder name should be "emails".

Parse variables to email template

Remove

$mail->Body = $body;

and Add

$message = $body;
$message = str_replace('%myName%', 'My Name Is Bla Bla', $message);
$mail->msgHTML($message);

You can use 'myName' variable inside your email template like this

Hi, %myName%

Releases

No releases published

Packages

No packages published