manyuanrong / deno-smtp

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

Connection with Office365 account "InvalidData: received corrupt message" #18

Open Spiderek opened 4 years ago

Spiderek commented 4 years ago

Dear Author, I'm trying to use your smtp module. But have some problems with connection to Microsoft smtp server. Thank you for your any support in advance.

I receive message: "InvalidData: received corrupt message" My configuration for office365 account: EMAIL_FROM = xyz@example.com (mylogin and primary e-mail address as well on Office365 with Exchange on-line license) EMAIL_PWD = my-password EMAIL_TO = recipient@example.com SMTP_SERVER = smtp.office365.com SMTP_PORT = 587 TLS = true

I've checked with my gmail account - it works perfect. So I assume my code must be correct. My configuration for gmail: EMAIL_FROM = xyz@example.com (mylogin same as my primary e-mail address as well on gmail) EMAIL_PWD = mypassword EMAIL_TO = recipient@example.com SMTP_SERVER=smtp.gmail.com SMTP_PORT=465 TLS=true

I've tested postfix as smtp relay to office365 account and sent e-mail from command line. Also works perfect. So my generally smtp client can connect with office365 and send e-mail. Any ideas ?


My code: const client = new SmtpClient(); const { EMAIL_FROM, EMAIL_TO, SMTP_SERVER, SMTP_PORT, TLS, EMAIL_PWD } = config();

        const configConnection = {
            hostname: SMTP_SERVER,
            port: SMTP_PORT ? parseInt(SMTP_PORT) : undefined,
            username: EMAIL_FROM,
            password: EMAIL_PWD,
        };

        if (TLS) {
            await client.connectTLS(configConnection);
        } else {
            await client.connect(configConnection);
        }

        await client.send({
            from: EMAIL_FROM,
            to: EMAIL_TO,
            subject: topic,
            content: message,
        });

hiral-kotadiya commented 3 years ago

With this same code snippet and my credentials I am getting the following error:

DenoStdInternalError: bufio: caught error from `readSlice()` without `partial` property
    at assert (https://deno.land/std@0.81.0/_util/assert.ts:13:11)
    at BufReader.readLine (https://deno.land/std@0.81.0/io/bufio.ts:254:7)
    at async TextProtoReader.readLineSlice (https://deno.land/std@0.81.0/textproto/mod.ts:131:17)
    at async TextProtoReader.readLine (https://deno.land/std@0.81.0/textproto/mod.ts:33:15)
    at async SmtpClient.readCmd (https://deno.land/x/smtp@v0.7.0/smtp.ts:151:20)
    at async SmtpClient._connect (https://deno.land/x/smtp@v0.7.0/smtp.ts:118:21)
    at async SmtpClient.connectTLS (https://deno.land/x/smtp@v0.7.0/smtp.ts:68:5)
shivajivarma commented 2 years ago

Is this resolved?

mathe42 commented 2 years ago

Not here at least! You can try my fork (https://deno.land/x/denomailer) see #57.