A test program to send mail using gmail works well on localhost:3000, but the same code does'nt work on meteor.com -


"meteor deploy testcode" uses mailgun. instead, want use gmail. small test program below works on 'localhost:3000'. returns error on 'meteor.com'. "error invoking method 'sendmail': internal server error [500]"

how use gmail properly.

(i set gmail account permission lower, , test program on localhost can send mail through gmail.)

// test.html   <head>     <title>test</title>   </head>    <body>     {{> test}}   </body>    <template name="test">     <input type="button" value="send mail">   </template>    // test.js   if (meteor.isclient) {     template.test.events({       'click [type="button"]':function(){         var datetime = new date();         console.log(datetime);         meteor.call('sendmail',datetime);       }     });    }    if (meteor.isserver) {      meteor.startup(function () {       var gmailaccount = {'eml':'user@gmail.com','pwd':'************'};       var st = 'smtp://' + encodeuricomponent(gmailaccount.eml) + ':' + gmailaccount.pwd + '@smtp.gmail.com' + ':465/'; check(st,string);       process.env.mail_url = st;     });      meteor.methods({       'sendmail':function(datetime){         var = 'user@gmail.com'; check(to,string);         var = 'user@gmail.com'; check(from,string);         var subject = 'test'; check(subject,string);         var text = 'time:' + datetime; check(text,string);         var sendobj = {'to':to, 'from':from, 'reply-to':from, 'subject':subject, 'text':text};         email.send(sendobj);       }     });    }   

gmail security check causes error.
"google account help" suggest 3 points. did of them , code works expected.

thank you.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -