@@ -51,6 +51,7 @@ const config = {
5151 port: 587 ,
5252 secure: false ,
5353 auth: {
54+ type: ' password' ,
5455 user: ' your-email@gmail.com' ,
5556 pass: ' your-app-password'
5657 }
@@ -59,15 +60,26 @@ const config = {
5960
6061### Authentication
6162
62- Deno Mailer supports LOGIN and PLAIN authentication methods.
63+ Deno Mailer supports two explicit authentication modes:
64+
65+ - ` type: 'password' ` using LOGIN with PLAIN fallback
66+ - ` type: 'oauth2' ` using XOAUTH2 bearer token
6367
6468``` ts
65- // Basic authentication object.
69+ // Password authentication object.
6670auth : {
71+ type : ' password' ,
6772 user : ' username' ,
6873 pass : ' password'
6974}
7075
76+ // OAuth2 authentication object.
77+ auth : {
78+ type : ' oauth2' ,
79+ user : ' username' ,
80+ accessToken : ' access-token-value'
81+ }
82+
7183// For local SMTP without auth, omit `auth`.
7284```
7385
@@ -368,13 +380,15 @@ await transporter.send({
368380
369381### Configuration Options
370382
371- | Option | Type | Required | Description | Example |
372- | ----------- | ------- | -------- | -------------------- | --------------------------- |
373- | ` host ` | string | yes | SMTP server hostname | ` 'smtp.gmail.com' ` |
374- | ` port ` | number | yes | SMTP server port | ` 587 ` , ` 465 ` , ` 25 ` |
375- | ` secure ` | boolean | no | Use TLS connection | ` true ` (465), ` false ` (587) |
376- | ` auth.user ` | string | no | SMTP username | ` 'user@example.com' ` |
377- | ` auth.pass ` | string | no | SMTP password | ` 'your-password' ` |
383+ | Option | Type | Required | Description | Example |
384+ | ------------------ | ------- | -------- | -------------------- | --------------------------- |
385+ | ` host ` | string | yes | SMTP server hostname | ` 'smtp.gmail.com' ` |
386+ | ` port ` | number | yes | SMTP server port | ` 587 ` , ` 465 ` , ` 25 ` |
387+ | ` secure ` | boolean | no | Use TLS connection | ` true ` (465), ` false ` (587) |
388+ | ` auth.type ` | string | no | Auth mode | ` 'password' ` , ` 'oauth2' ` |
389+ | ` auth.user ` | string | no | SMTP username | ` 'user@example.com' ` |
390+ | ` auth.pass ` | string | no | SMTP password | ` 'your-password' ` |
391+ | ` auth.accessToken ` | string | no | OAuth2 bearer token | ` 'ya29.a0...' ` |
378392
379393### Message Properties
380394
@@ -423,6 +437,7 @@ const transporter = mailer.transporter({
423437 port: 587 ,
424438 secure: false ,
425439 auth: {
440+ type: ' password' ,
426441 user: ' your-email@gmail.com' ,
427442 pass: ' your-app-password'
428443 }
@@ -438,6 +453,7 @@ const transporter = mailer.transporter({
438453 port: 587 ,
439454 secure: false ,
440455 auth: {
456+ type: ' password' ,
441457 user: ' your-email@outlook.com' ,
442458 pass: ' your-password'
443459 }
@@ -453,6 +469,7 @@ const transporter = mailer.transporter({
453469 port: 587 ,
454470 secure: false ,
455471 auth: {
472+ type: ' password' ,
456473 user: ' noreply@yourcompany.com' ,
457474 pass: ' your-password'
458475 }
0 commit comments