I am new to meteor js. Could you please suggest me how to add email template containing embed html code in meteor project. I had tried few packages,but its not working.Could you please explain with a sample example.
Note: When a user register into my site. Both of us (new user and me) have to get the email. Both contains different embed html content.
Here is a basic example assuming you use blaze:
In your template events:
Mail template:
Inside your methods:
You only need email package (
meteor add email
in console or addemail
to your packages) and configure SMTP for this to work. Documentation for email package and usage hereSMTP configuration example (in server!)
If you get whats going on in this code, you can easily play with it and send different emails with different data using different html templates
I luckily implemented this requirement yesterday. So below is the direction to send HTML using email package.
execute command;
Create an HTML which will be accessible by SERVER.
below is the sample code for HTML at PROJECT/email.html to add email package
In SERVER/main.js file you need to import the package using,
above code is for gmail SMTP configuration enabled emailing. check email and Voila..!!!! it works. Enjoy! Happy coding!