”;
This package is used when you need to send an email from Meteor App.
Step 1 – Add Package
Open the command prompt window and run the following command −
C:UsersusernameDesktopmeteorApp>meteor add email
Step 2 – Mailgun Account
We need to create an account here. This is the default email provider for Meteor apps.
After you are logged in, open the Domains tab and click the sandbox URL below the Domain Name. It will open a new page where we can find Default SMTP Login and Default Password. We will need these two for creating the MAIL_URL environment variable.
Send Email
To create a valid MAIL_URL just insert your Mailgun credentials in place of YOUR_DEFAULT_SMTP_LOGIN and YOUR_DEFAULT_PASSWORD.
if (Meteor.isServer) { Meteor.startup( function() { process.env.MAIL_URL = "smtp://YOUR_DEFAULT_SMTP_LOGIN:[email protected]:587"; Email.send({ to: "[email protected]", from: "[email protected]", subject: "Meteor Email", text: "The email content..." }); }); }
When you run the app, the email will be sent to your address.
Advertisements
”;