【发布时间】: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
【问题讨论】:
-
那个模块没有更新,上个版本v0.4.0,只支持Deno 0.42.0。我建议你使用另一个模块。
-
你能从这个链接检查解决方案吗:stackoverflow.com/questions/61757437/…
标签: javascript email smtp deno