【问题标题】:Can not connect to smtp server deno无法连接到 smtp 服务器 deno
【发布时间】:2020-09-19 04:40:07
【问题描述】:

我对 deno 还很陌生,我试图用它发送邮件,使用模块 smtp-client。

import { SmtpClient } from "https://deno.land/x/smtp/mod.ts";

const client = new SmtpClient();

await client.connect({ // this is the line where error is thrown
  host: "smtp.google.com",
  port: 465,
  username: "<MY EMAIL>",
  password: "<MY EMAIL PASSWORD>",
});
// etc...

但它给了我一个错误,甚至在尝试提出请求之前 (sendMail)。

[0] error: Uncaught InvalidData: data did not match any variant of untagged enum ArgsEnum
[0]     at unwrapResponse ($deno$/ops/dispatch_json.ts:43:11)
[0]     at Object.sendAsync ($deno$/ops/dispatch_json.ts:98:10)
[0]     at async Object.connect ($deno$/net.ts:180:11)
[0]     at async SmtpClient.connect (https://deno.land/x/smtp/smtp.ts:28:18)
[0]     at async file:///C:/path/to/server/controller.js:5:1

【问题讨论】:

标签: javascript email smtp deno


【解决方案1】:

gamil (AFAIK) 的 smtp 服务器是 smtp.gmail.com

然后你必须在 gmail 上激活“安全性较低的应用程序”以允许 smtp 客户端连接

【讨论】:

    猜你喜欢
    • 2015-06-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多