我刚开始学习Deno,并尝试使用它发送邮件。
import { SmtpClient } from "./deps.js";
await client.connectTLS({
host: "smtp.163.com",
port: 465,
username: "my email",
password: "my password",
});
await client.send({
from: "mailaddress@163.com",
to: "t32n5nr@prowerl.com",
subject: "Mail Title",
content: "Mail Content,maybe HTML",
});
我按照SmtpClient文档中所说的做了一切
,但是我收到了一个错误
error: Uncaught ConnectionRefused: No connection could be made because the target machine actively refused it. (os error 10061)
at unwrapResponse ($deno$/ops/dispatch_json.ts:43:11)
at Object.sendAsync ($deno$/ops/dispatch_json.ts:98:10)
at async Object.connectTls ($deno$/tls.ts:20:15)
at async SmtpClient.connectTLS (https://deno.land/x/smtp/smtp.ts:36:18)
at async file:///C:/.../controller.js:28:1
deno --version
版本以及./deps.ts
文件,我在这里遇到了不同的错误。 - Evandro Pomattiexport { Application } from "https://deno.land/x/oak/mod.ts"; export { SmtpClient } from "https://deno.land/x/smtp/mod.ts";
- Shotiko Topchishvilitelnet smtp.163.com 465
。如果显示"Connection refused",意味着该端口无法访问或已关闭。您是否受到防火墙或代理的限制?我通过Google进行了测试,并且工作正常。 - Evandro Pomatti