Could not send email from Meteor using MAIL_URL

I was trying to send emails using MAIL_URL from meteor app which is deployed too. Im successful in sending emails which displays in the terminal. When thought of sending to my gmail id using MAIL_URL it didn’t work out for me. When i type in the command ‘MAIL_URL’ in the meteor app directory command prompt it says ‘MAIL_URL is not recognized as internal or external command’.

Please help me in understanding what did i miss here. I knew that im close to the solution but stuck in some manner. Your great help is highly appreicated.

Thanks,

MAIL_URL is an environment variable for the server where you configure your email API.
You can’t type that into the JS Console of a client and see anything.
That variable should be secret and only visible on the server.

On the server you should be using the Email function.

http://docs.meteor.com/#/full/email

Hi,

Thanks for your reply. I have put up the server settings in my js file inside (Meteor.isServer()) block as below

But still i could not be successful in sending emails. When i referred in the console it says 'Exception while invoking method ‘sendEmail’ AuthError

Please help me in this regard.

Your help here is highly appreciated.

Regards,
Leo

I’ve just build a small app to send email in markdown this morning. I was using it with gmail, and everything worked fine.

Did you try with the 587 port ? That’s the one i’ve used.

Can we get the entire error ?

Hi Shad,

Thanks for your reply. I didn’t use the port 587. Please see to the entire error list

Note: I used port # 465.

From what i read, it says that you’re login is wrong (google server says it). So it’s likely that you’re settings are wrong, either login or password…

Do i need to give my gmail user id in full form ( as like which should ends with @gmail.com). Because in the server block i just gave only my user id. It looks i tried with port 587. Sorry no luck.

Hi Shad,

  process.env.MAIL_URL="smtp://leo.jesudoss:marydoss@smtp.gmail.com:587/";

Below is the way i have configured my smtp details. Post refreshing the browser i get the below window 

Please advise. Your help is appreciated.

No, you don’t need to give the entire email when you use gmail. The id is enough. But again, the message is pretty clear…

AuthError: Invalid login does mean that your login/password couple is wrong. Or maybe you don’t have permissions to use it with gmail. I think you do have to activate IMAP on you’re gmail account, which would be under Gmail Settings in Forwarding Pop/Imap (but i’m not sure if it’s related).

Hi,

Im using port # 465 to connect gmail via smtp. Still i get exception saying 'Exception invoking method ‘sendEmail’. But i also got an email from google saying ‘Sign-in attempt prevented’. It looks google is considering request that i send to be less secure and hence stops. I also enabled IMAP settings in gmail.

Below is the content of the email that i get in my inbox.

Hi Leo,
Someone just tried to sign in to your Google Account leo.jesudoss@gmail.com from an app that doesn’t meet modern security standards.
Details:
Wednesday, September 16, 2015 1:01 PM (India Standard Time)
Chennai, Tamil Nadu, India*
We strongly recommend that you use a secure app, like Gmail, to access your account. All apps made by Google meet these security standards. Using a less secure app, on the other hand, could leave your account vulnerable. Learn more.

Google stopped this sign-in attempt, but you should review your recently used devices:

Please advise.

Although I’m guessing there is a better way, the way I was able to get around this was by going to the following google url and changing my account to allow “less secure apps.” Here’s the url: https://www.google.com/settings/u/2/security/lesssecureapps

1 Like

Helped me as well, but how exactly does it make my mail “less secure”??

I guess, meteor doesn’t support sending encrypted mail via SSL (like in outlook:

I couldn’t find a similar “less secure apps” settings in my local mail providers (mail.ru, yandex.ru), and whenever I try to send mail with meteor through them I receive the following error:
[SenderError: Mail from command failed - 550 not local sender over smtp]

So does Meteor support email SSL?

I’m also having the same problem, and the findings in this posts helped me out. However, I could also not figure out - is meteor sending email without SSL? I see the last post was about 3 months ago…

Doesnt seem like many ppl need this feature…
I’m using mailgun currently - it’s relatevily easy to setup and they have a generous free tier.

1 Like

I’m facing the same problem here: error 500.

BTW, to remove the “Exception” message add a Meteor.isServer in your method

careful, your username and password are on display here… I just tested them. (you might have gotten a propt on you mobile!)

1 Like

I am also experiencing this problem. The MAIL_URL is set correctly, however what’s interesting is the mails send via a buttom (I have one button done by myself for subscribing to news letter) are working fine. The mails sent via accounts are not working. Debugging the packaage seems that the MAIL_URL is correct but the problem comes from mailcomposer. Any solution?

I’ve also been fiddling with this quite a bit, and noticed that you have to use percent-encoding if you have special characters in your password.

Here is an example that worked for me at some point, although only with “allow less secure apps” turned on in GMail:

export MAIL_URL='smtps://user.name:pass%21word@smtp.gmail.com:465/'
meteor

Interesting enough, it started failing again later, maybe related to “being logged in to Google in a Web Browser” versus logging out there. In the end, it wasn’t clear to me how GMail behaved with respect to authentication.

Following other’s advice, you might want to follow https://themeteorchef.com/tutorials/using-the-email-package which provides instructions for the Mailgun service.