manyuanrong / deno-smtp

SMTP implements for deno
MIT License
78 stars 26 forks source link

ConnectionRefused: Connection refused (os error 111) #58

Open nhattruong1 opened 1 year ago

nhattruong1 commented 1 year ago

I deploy my project deno in https://dash.deno.com/ after using deno-smtp deploy failed but it work fine in develop environment (localhost).

ConnectionRefused: Connection refused (os error 111) at async Object.connectTls (deno:ext/net/02_tls.js:37:42) at async SmtpClient.connectTLS (https://deno.land/x/smtp@v0.7.0/smtp.ts:35:22) at async file:///src/core/service/mail/index.ts:5:1

here is the code snippet:

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

interface informationMail{
    to: string,
    subject: string,
    text: string,
    html: string,
}
const client = new SmtpClient();

await client.connectTLS({
    hostname: "smtp.gmail.com",
    port: 465,
    username: Deno.env.get("EMAIL_DOMAIN"),
    password: Deno.env.get("EMAIL_APP_PASSWORD"),
});

export async function sendMail() {
    await client.send({
        from: Deno.env.get("EMAIL_DOMAIN"),
        to: "truongvo.dev@gmail.com", // list of receivers
        subject: "Hello ✔", // Subject line
        content: "Hello world?", // plain text body
    });

    return await client.close();
}

Does anyone know how to solve this problem ? Thank you

mathe42 commented 1 year ago

This is the same with my fork denomailer. They block ports 25, 465 and a third Port to prevent Spam....

nhattruong1 commented 1 year ago

This is the same with my fork denomailer. They block ports 25, 465 and a third Port to prevent Spam....

how did you fix it?

mathe42 commented 1 year ago

There is no fix with deno deploy...

KevDev99 commented 5 months ago

this is just insane, its blocking 25, 465, and 587. 99% of standard mail services use these ports and its not possible to change....