universal-mailer-lib 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -52,6 +52,40 @@ console.log(result.messageId) // Gmail message ID
|
|
|
52
52
|
- Select scope: `https://www.googleapis.com/auth/gmail.send`
|
|
53
53
|
- Authorize and exchange for tokens
|
|
54
54
|
|
|
55
|
+
## Gmail API Usage
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
import { UniversalMailer } from 'universal-mailer-lib'
|
|
59
|
+
|
|
60
|
+
const mailer = new UniversalMailer({
|
|
61
|
+
transport: 'gmail-api', // ⚠️ Use 'gmail-api', NOT 'gmail'
|
|
62
|
+
gmailApi: {
|
|
63
|
+
clientId: 'your-client-id.apps.googleusercontent.com',
|
|
64
|
+
clientSecret: 'your-client-secret',
|
|
65
|
+
refreshToken: 'your-refresh-token'
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
const result = await mailer.sendEmail({
|
|
70
|
+
from: 'you@gmail.com',
|
|
71
|
+
to: 'recipient@example.com',
|
|
72
|
+
subject: 'Hello from UniversalMailer',
|
|
73
|
+
html: '<h1>Hello World</h1><p>This is a test email.</p>',
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
console.log(result.messageId) // Gmail message ID
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### ⚠️ Important: Use `gmail-api`, not `gmail`
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
// ✅ Correct
|
|
83
|
+
transport: 'gmail-api'
|
|
84
|
+
|
|
85
|
+
// ❌ Wrong - this will fail
|
|
86
|
+
transport: 'gmail'
|
|
87
|
+
```
|
|
88
|
+
|
|
55
89
|
## Features
|
|
56
90
|
|
|
57
91
|
### HTML Email
|