@upyo/mailgun 0.1.0-dev.11 → 0.1.0-dev.12

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.
Files changed (2) hide show
  1. package/README.md +20 -11
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -32,22 +32,31 @@ Usage
32
32
  -----
33
33
 
34
34
  ~~~~ typescript
35
- import { MailgunTransport } from '@upyo/mailgun';
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: 'your-api-key',
39
- domain: 'your-domain.com'
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('Message sent:', receipt.messageId);
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.11+9d41b08f",
3
+ "version": "0.1.0-dev.12+d36debdf",
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.11+9d41b08f"
56
+ "@upyo/core": "0.1.0-dev.12+d36debdf"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@dotenvx/dotenvx": "^1.47.3",