Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Spiderek opened this issue Jun 24, 2020 · 3 comments

Comments

@Spiderek
Copy link

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
Copy link

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
Copy link

Is this resolved?

@mathe42
Copy link

mathe42 commented Aug 5, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants