Notice: The Monaca & Onsen UI Community Forum is shutting down.
For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.
Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.
Mailer Templates
-
I see in the ‘sendMail’ command that I can pass ‘substituteParams’ to my mail template. How do I insert these parameters into the mail template? I don’t see any information on how to do this. Thanks
-
@rmoore Here is an example of how to use
sendMail
method:monaca.cloud.Mailer.sendMail("userOidA", "template_a", {"name": username, "date": currentDate}) .done ( function() { /* What to do after sending an email is success. */ } );
{"name": username, "date": currentDate}
is a JSON object which is thesubstituteParams
in the above example.
-
@khemry How do I create the email template to use those variables? I’m currently doing the following:
https://www.dropbox.com/s/1ld91il6behjqku/Screenshot 2018-09-19 14.45.36.png?dl=0
-
@rmoore Sorry for a late reply. Here is how to use the parameter with the email template. First, create a template as shown here:
Here is a sample code for SendMail function:
monaca.cloud.Mailer.sendMail(UserOid, "DemoTemplate", {"name": "Khemry Khourn"}) .done(function(result) { if (result == "OK") { console.log("The email is sent successfully."); } }) .fail(function(err) { console.log("Error #" + err.code +": " + err.message); });