Can not send email from meteor

I am using this code but it doesn’t send any email…

CODE ON CLIENT SIDE

Meteor.call(‘sendEmail’,
‘emailusername@gmail.com’,
‘emailusername@gmail.com’,
‘Email Subject’,
‘This is a test of Email.send.’);

CODE ON SERVER SIDE

process.env.MAIL_URL = “smtp://emailusername:emailpassword@smtp.gmail.com:465/” ;

Meteor.methods({
sendEmail: function (to, from, subject, text) {
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: to,
  from: from,
  subject: subject,
  text: text
});

}
});

What machine/cloud IDE/version are you using?

are you including the emailusername in this format name%40domain.com ?

I don’t use gmail with meteor, but when I did, I recall that being an issue

hello… i’ve debug and got this message : Error invoking Method ‘sendEmail’: Internal server error [500]

ok i try to add %40 first…

I have change process.env.MAIL_URL = “smtp://emailusername%40gmail.com:emailpassword@smtp.gmail.com:465/” ;

But still got error message : Error invoking Method ‘sendEmail’: Internal server error [500]

if you console.log() the error, you’ll get an error object.

It should give you more details of the error.

Also, you’re not deployed at .meteor.com are you?

How can I put console.log() in mycode. The send email code is put on server.js…

on the server, console.log() outputs to the server console (the terminal)

Hello and thought I post my problem here as it’s similar issue - simply the email package not working for me:( and appreciate and ideas:

When I click a Submit to send the email on my Localhost, I get the email to print in the server terminal console. But when I add the environment variable and run the same on the Localhost, I get the error:
“AuthError: Invalid login -535 5.7.0 Mailgun is not loving your login or password”

When I deploy to meteor servers and try to Submit the form to send the email, nothing happens it seems as I don’t receive the email.
For the MAIL_URL environment variable, I do per the instructions and use the mailgun sandbox login (postmaster@sandbox…_and the mailgun default password (the lengthy random string)
I also use the same sandbox login in the from field in the Email.send function, and not sure if that is correct?
Also, is there a way to see what’s happening on the meteor server. I’m deploying to the myapp.meteor.com servers.
Thanks much

figured it out…thanks to the meteor ‘logs’ command I just now discovered! the logs pinpoint the issues. after bunch of iterations, I did away with the MAIL_URL variable for now as not needed because of the native integration for that basic meteor deployment. it was then the ‘from’ field it didn’t like and for now, the mailgun default email (with the free signup) the postmaster@samdbox… works as a ‘from’ email address. so far, i’ve only sent email to a gmail account and works fine, though not live.com… so still need more work and probably need my own domain with mailgun for servers not to trash the email or something. we’ll see.
http://blog.mailgun.com/native-mailgun-integration-lets-meteor-apps-send-email/