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

send email failed by office365 smtp #73

Open
carlos411 opened this issue May 23, 2023 · 0 comments
Open

send email failed by office365 smtp #73

carlos411 opened this issue May 23, 2023 · 0 comments
Assignees
Labels
bug Something isn't working triage

Comments

@carlos411
Copy link

Describe the bug

send email failed by office365 smtp

To Reproduce

My Code:

import { SMTPClient } from "https://deno.land/x/denomailer@1.6.0/mod.ts"

const client = new SMTPClient({
  debug: {
    log: true
  },
  connection: {
    hostname: "smtp.office365.com",
    port: 587,
    tls: false,
    auth: {
      username: "my_email",
      password: "my_password"
    }
  }
});

await client.send({
  from: "ServiceName <my_email>",
  to: "ReceiverName <other_email>",
  subject: "my subject test",
  html: "<h1>this is heading</h1>"
});

await client.close();

Expected behavior

Send email normally.

Logs

deno --version output:

deno 1.33.4 (release, x86_64-apple-darwin)
v8 11.4.183.2
typescript 5.0.4

debug output log

used resolved config
.debug
┌───────────────┬────────┐
│ (idx)         │ Values │
├───────────────┼────────┤
│ log           │ true   │
│ allowUnsecure │ false  │
│ encodeLB      │ false  │
│ noStartTLS    │ false  │
└───────────────┴────────┘
.connection
┌──────────┬───────────────────────────────────────────────────────────────┐
│ (idx)    │ Values                                                        │
├──────────┼───────────────────────────────────────────────────────────────┤
│ hostname │ "smtp.office365.com"                                          │
│ port     │ 587                                                           │
│ tls      │ false                                                         │
│ auth     │ '{"username":"my_email","password":"my_password"}' │
└──────────┴───────────────────────────────────────────────────────────────┘
.pool
undefined
220 TYWPR01CA0019.outlook.office365.com Microsoft ESMTP MAIL Service ready at Tue, 23 May 2023 15:35:07 +0000
┌───────┬──────────────────────┐
│ (idx) │ Values               │
├───────┼──────────────────────┤
│     0 │ "EHLO"               │
│     1 │ "smtp.office365.com" │
└───────┴──────────────────────┘
250-TYWPR01CA0019.outlook.office365.com Hello [219.68.233.17]
250-SIZE 157286400
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250 SMTPUTF8
┌───────┬────────────┐
│ (idx) │ Values     │
├───────┼────────────┤
│     0 │ "STARTTLS" │
└───────┴────────────┘
error: Uncaught (in promise) Error: invalid cmd
      throw new Error(`invalid cmd`);
            ^
    at SMTPConnection.assertCode (https://deno.land/x/denomailer@1.6.0/client/basic/connection.ts:76:13)
    at SMTPConnection.writeCmdAndAssert (https://deno.land/x/denomailer@1.6.0/client/basic/connection.ts:132:10)
    at eventLoopTick (ext:core/01_core.js:181:11)

Could you help to fix it? Thanks a lot!
On the other hand, If I use Node.js package NODEMAILER under Node.js environment, it can send email normally.

@carlos411 carlos411 added bug Something isn't working triage labels May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

2 participants