【问题标题】:Meteor email error for gmail servergmail服务器的流星电子邮件错误
【发布时间】:2017-12-23 02:33:16
【问题描述】:

我的 server.js 文件包含以下代码段,它们应该配置 gmail 地址并发送电子邮件。

Meteor.startup(() => {
  // code to run on server at startup
    process.env.MAIL_URL = 'smtps://email_address@gmail.com:password_without_special_keys@smtp.gmail.com:465';

    Email.send({
        from: "from_adddress@gmail.com",
        to: "to_address@gmail.com",
        subject: "Meteor Can Send Emails via Gmail",
        text: "Its pretty easy to send emails via gmail."
    })



});

当我使用命令运行应用程序时,我的流星应用程序是否应该发送电子邮件

流星

?? 但它提供了以下错误。怎么了?

W20170718-15:36:37.701(6)? (STDERR) /home/forhadmethun/.meteor/packages/meteor-tool/.1.5.1.dvn6c8++os.linux.x86_32+web.browser+web.cordova/mt-os.linux.x86_32/dev_bundle/server-lib/node_modules/fibers/future.js:313
W20170718-15:36:37.766(6)? (STDERR)                                             throw(ex);
W20170718-15:36:37.767(6)? (STDERR)                                             ^
W20170718-15:36:37.769(6)? (STDERR) 
W20170718-15:36:37.769(6)? (STDERR) Error: Connection timeout
W20170718-15:36:37.770(6)? (STDERR)     at Object.Future.wait (/home/forhadmethun/.meteor/packages/meteor-tool/.1.5.1.dvn6c8++os.linux.x86_32+web.browser+web.cordova/mt-os.linux.x86_32/dev_bundle/server-lib/node_modules/fibers/future.js:449:15)
W20170718-15:36:37.771(6)? (STDERR)     at Mail._syncSendMail (packages/meteor.js:213:24)
W20170718-15:36:37.772(6)? (STDERR)     at smtpSend (packages/email.js:116:13)
W20170718-15:36:37.773(6)? (STDERR)     at Object.Email.send (packages/email.js:174:5)
W20170718-15:36:37.774(6)? (STDERR)     at server/main.js:28:11
W20170718-15:36:37.775(6)? (STDERR)     at Function.time (/home/forhadmethun/WebstormProjects/EmailSEndProject/.meteor/local/build/programs/server/profile.js:309:28)
W20170718-15:36:37.776(6)? (STDERR)     at /home/forhadmethun/WebstormProjects/EmailSEndProject/.meteor/local/build/programs/server/boot.js:347:13
W20170718-15:36:37.777(6)? (STDERR)     at /home/forhadmethun/WebstormProjects/EmailSEndProject/.meteor/local/build/programs/server/boot.js:388:5
W20170718-15:36:37.779(6)? (STDERR)     at Function.run (/home/forhadmethun/WebstormProjects/EmailSEndProject/.meteor/local/build/programs/server/profile.js:510:12)
W20170718-15:36:37.780(6)? (STDERR)     at /home/forhadmethun/WebstormProjects/EmailSEndProject/.meteor/local/build/programs/server/boot.js:386:11
W20170718-15:36:37.781(6)? (STDERR)     - - - - -
W20170718-15:36:37.782(6)? (STDERR)     at SMTPConnection._formatError (/home/forhadmethun/.meteor/packages/email/.1.2.3.3ikb16++os+web.browser+web.cordova/npm/node_modules/node4mailer/lib/smtp-connection/index.js:558:19)
W20170718-15:36:37.784(6)? (STDERR)     at SMTPConnection._onError (/home/forhadmethun/.meteor/packages/email/.1.2.3.3ikb16++os+web.browser+web.cordova/npm/node_modules/node4mailer/lib/smtp-connection/index.js:531:20)
W20170718-15:36:37.785(6)? (STDERR)     at [object Object].<anonymous> (/home/forhadmethun/.meteor/packages/email/.1.2.3.3ikb16++os+web.browser+web.cordova/npm/node_modules/node4mailer/lib/smtp-connection/index.js:249:18)
W20170718-15:36:37.787(6)? (STDERR)     at Timer.listOnTimeout (timers.js:92:15)

【问题讨论】:

    标签: meteor gmail meteor-accounts


    【解决方案1】:

    您的 MAIL_URL 变量应如下所示

    smtps://username%40gmail.com:password@smtp.gmail.com:465
    

    如果这没有帮助,您将需要 allow the less secure applicationsallow access to your account。如果正确完成此步骤,应该允许从 Gmail 发送电子邮件。您可以查看此answer,了解有关 Gmail 安全规则的更多信息。

    【讨论】:

      猜你喜欢
      • 2016-11-04
      • 1970-01-01
      • 2016-09-07
      • 1970-01-01
      • 2017-05-28
      • 1970-01-01
      • 2014-07-30
      • 2020-03-09
      • 2015-04-17
      相关资源
      最近更新 更多