@upyo/mailgun 0.1.0-dev.11 → 0.1.0-dev.13
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 +20 -11
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -32,22 +32,31 @@ Usage
|
|
|
32
32
|
-----
|
|
33
33
|
|
|
34
34
|
~~~~ typescript
|
|
35
|
-
import {
|
|
35
|
+
import { createMessage } from "@upyo/core";
|
|
36
|
+
import { MailgunTransport } from "@upyo/mailgun";
|
|
37
|
+
import fs from "node:fs/promises";
|
|
38
|
+
import process from "node:process";
|
|
39
|
+
|
|
40
|
+
const message = createMessage({
|
|
41
|
+
from: "sender@example.com",
|
|
42
|
+
to: "recipient@example.net",
|
|
43
|
+
subject: "Hello from Upyo!",
|
|
44
|
+
content: { text: "This is a test email." },
|
|
45
|
+
attachments: [
|
|
46
|
+
new File(
|
|
47
|
+
[await fs.readFile("image.jpg"), "image.jpg", { type: "image/jpeg" }]
|
|
48
|
+
)
|
|
49
|
+
],
|
|
50
|
+
});
|
|
36
51
|
|
|
37
52
|
const transport = new MailgunTransport({
|
|
38
|
-
apiKey:
|
|
39
|
-
domain:
|
|
53
|
+
apiKey: process.env.MAILGUN_KEY!,
|
|
54
|
+
domain: process.env.MAILGUN_DOMAIN!,
|
|
55
|
+
region: process.env.MAILGUN_REGION as "us" | "eu",
|
|
40
56
|
});
|
|
41
57
|
|
|
42
|
-
const message = {
|
|
43
|
-
sender: { address: 'sender@example.com' },
|
|
44
|
-
recipients: [{ address: 'recipient@example.com' }],
|
|
45
|
-
subject: 'Hello from Mailgun!',
|
|
46
|
-
content: { text: 'Hello, World!' }
|
|
47
|
-
};
|
|
48
|
-
|
|
49
58
|
const receipt = await transport.send(message);
|
|
50
|
-
console.log(
|
|
59
|
+
console.log("Email sent:", receipt.successful);
|
|
51
60
|
~~~~
|
|
52
61
|
|
|
53
62
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@upyo/mailgun",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.13+aad44636",
|
|
4
4
|
"description": "Mailgun transport for Upyo email library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"email",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"sideEffects": false,
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"@upyo/core": "0.1.0-dev.
|
|
56
|
+
"@upyo/core": "0.1.0-dev.13+aad44636"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@dotenvx/dotenvx": "^1.47.3",
|