How to send email notification using Email.send?

Hi,

I was wondering how do I send an email notification using email.send?

I’ve been able to implement sending verification email and reset password email. However this was a simple configuration on /server and on /both.

How do I invoke an email to be sent?

https://themeteorchef.com/search/?q=email

Thanks for the recommendation. I tried searching and reading there. The problem is not defining the templates or setting up the emails.

I’ve an issue “calling” the email method like say when someone replies to a post in my web application.

Can you do it in the method? On the reply’s click event, call a method and send it the relevant info and call the send.email with the given template.

Meteor.methods({
    sendEmailOnReplyMethod: function( replyRecipientId){

    SSR.compileTemplate( 'htmlEmail', Assets.getText( 'you-got-a-reply-email.html' ) );

        var thisUserDoc = Meteor.users.findOne({_id: replyRecipientId});
        var thisUserEmail = thisUserDoc.emails[0].address;


        Email.send({
            to: thisUserEmail,
            from: 'noreply@mywebsite.io',
            subject: "You got a reply!",
            html: SSR.render( 'htmlEmail' )
        });
    }
});
1 Like