Intallation:
meteor add email
inside server’s main.js, put the follwoing line inside for configuring email…
Meteor.startup(() => {
process.env.MAIL_URL = 'smtp://mail_user_name@gmail.com:password@smtp.gmail.com:465';
}
please use mail_user_name and password simple english character do not put any non alphabetical character as name or password like ‘amarmail01’ as username or ‘pass12345’ as a password. It may create problem.
for example, use something like the following example
say your email name: amaremail@gmail.com
password: amargmailpassword
Meteor.startup(() => {
process.env.MAIL_URL = 'smtp://amaremail@gmail.amargmailpassword@smtp.gmail.com:465';
}
[[ https://stackoverflow.com/questions/44612761/how-to-properly-configure-mail-url ]]
After configuring the email to send email one method can be written in the server side and the method can be called to send email…
Meteor.methods({
sendEmail(to, from, subject, text) {
// Make sure that all arguments are strings.
// check([to, from, subject, text], [String]);
// Let other method calls from the same client start running, without
// waiting for the email sending to complete.
this.unblock();
Email.send({ to, from, subject, text });
}
});
Meteor.call(
‘sendEmail’,
‘to_email_address_mail@gmail.com’,
‘from_email_address_name@gmail.com’,
‘Hello from Meteor!’,
‘This is a test of Email.send.’
);