2

I'm just trying to send verification email in Meteor, based on this docs: https://github.com/Shekharrajak/meteor-email , it returns the error below. I followed the doc verbatim.

My code

import { Meteor } from 'meteor/meteor';

if (Meteor.isServer){
  Meteor.startup(() => {
    process.env.MAIL_URL="smtp://mygmailaddress%40gmail.com:mypassword@smtp.gmail.com:465/";
  });

  Email.send({
  to: "sendeto@yahoo.com",
  from: "sendfrom@gmail.com",
  subject: "Example Email",
  text: "The contents of our email in plain text.",
});

}

Error message:

W20170420-14:49:33.820(1)? (STDERR) js-bson: Failed to load c++ bson extension, using pure JS version
I20170420-14:49:34.997(1)? ====== BEGIN MAIL #0 ======
I20170420-14:49:34.998(1)? (Mail not sent; to enable sending, set the MAIL_URL environment variable.)
I20170420-14:49:35.019(1)? Content-Type: text/plain
I20170420-14:49:35.021(1)? From: kehindeadeoya@gmail.com
I20170420-14:49:35.023(1)? To: ken4ward@yahoo.com
I20170420-14:49:35.026(1)? Subject: Example Email
I20170420-14:49:35.027(1)? Message-ID: <6b59f210-f727-aff3-2695-335a774e936a@gmail.com>
I20170420-14:49:35.028(1)? Content-Transfer-Encoding: 7bit
I20170420-14:49:35.031(1)? Date: Thu, 20 Apr 2017 13:49:35 +0000
I20170420-14:49:35.032(1)? MIME-Version: 1.0
I20170420-14:49:35.034(1)?
I20170420-14:49:35.050(1)? The contents of our email in plain text.
I20170420-14:49:35.052(1)? ====== END MAIL #0 ======

What am i to do right? Please assist.

ken4ward
  • 2,246
  • 5
  • 49
  • 89
  • 2
    are you sure the process environment variable is set before you are trying to send the email? Try putting the `Email.send` in the startup block. – bergjs Apr 20 '17 at 20:54
  • 1
    If you are using `Meteor.isServer` here, it suggests that your secrets are being sent to the client. This file should be in the `server/` directory. – Brendon Sep 13 '17 at 08:00

4 Answers4

1

check this link Maybe you have misconfigured the system with mailgun.

Use the package meteorhacks: ssr more practical to send and personalize the mail.

1
import { Meteor } from 'meteor/meteor';

Meteor.startup(function () {
  if(Meteor.isServer) {
 process.env.MAIL_URL="smtp://mygmailaddress%40gmail.com:mypassword@smtp.gmail.com:465/";

Email.send({
  to: to,
  from: "sendfrom@gmail.com",
  subject: "Example Email",
  text: "The contents of our email in plain text.",
     });
  });
}
Dileephell
  • 620
  • 2
  • 7
  • 18
1

Or you can export the MAIL_URL in the terminal before you run meteor, like this:

export MAIL_URL="smtp://yourGmailAddress:yourPassword@smtp.gmail.com:587"
0

Though I finally used gmail, the simple mistake I was making is not adding the email in the meteor is server method: Thanks for the contribution.

import { Meteor } from 'meteor/meteor';

if (Meteor.isServer){
  Meteor.startup(() => {
 process.env.MAIL_URL="smtp://mygmailaddress%40gmail.com:mypassword@smtp.gmail.com:465/";
Email.send({
  to: "sendeto@yahoo.com",
  from: "sendfrom@gmail.com",
  subject: "Example Email",
  text: "The contents of our email in plain text.",
});
  });
}
ken4ward
  • 2,246
  • 5
  • 49
  • 89