Skip to content

Commit ea73453

Browse files
committed
mailosaur init
1 parent 02b76b8 commit ea73453

File tree

7 files changed

+606
-6
lines changed

7 files changed

+606
-6
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import mailosaur from "../../mailosaur.app.mjs";
2+
3+
export default {
4+
key: "mailosaur-create-email",
5+
name: "Create and Send Email via Mailosaur",
6+
description: "Sends an email through Mailosaur. [See the documentation](https://mailosaur.com/docs/api)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
mailosaur,
11+
serverId: {
12+
propDefinition: [
13+
mailosaur,
14+
"serverId",
15+
],
16+
},
17+
to: {
18+
propDefinition: [
19+
mailosaur,
20+
"to",
21+
],
22+
},
23+
subject: {
24+
propDefinition: [
25+
mailosaur,
26+
"subject",
27+
],
28+
},
29+
from: {
30+
propDefinition: [
31+
mailosaur,
32+
"from",
33+
],
34+
optional: true,
35+
},
36+
html: {
37+
propDefinition: [
38+
mailosaur,
39+
"html",
40+
],
41+
optional: true,
42+
},
43+
text: {
44+
propDefinition: [
45+
mailosaur,
46+
"text",
47+
],
48+
optional: true,
49+
},
50+
send: {
51+
propDefinition: [
52+
mailosaur,
53+
"send",
54+
],
55+
optional: true,
56+
},
57+
attachments: {
58+
propDefinition: [
59+
mailosaur,
60+
"attachments",
61+
],
62+
optional: true,
63+
},
64+
},
65+
async run({ $ }) {
66+
const response = await this.mailosaur.sendEmail({
67+
serverId: this.serverId,
68+
to: this.to,
69+
subject: this.subject,
70+
from: this.from,
71+
html: this.html,
72+
text: this.text,
73+
send: this.send,
74+
attachments: this.attachments
75+
? this.attachments.map(JSON.parse)
76+
: undefined,
77+
});
78+
79+
$.export("$summary", `Email sent successfully to ${this.to}`);
80+
return response;
81+
},
82+
};
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import mailosaur from "../../mailosaur.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "mailosaur-delete-email",
6+
name: "Delete Email",
7+
description: "Deletes an email from a Mailosaur server using its email ID. [See the documentation](https://mailosaur.com/docs/api)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
mailosaur,
12+
emailId: {
13+
propDefinition: [
14+
mailosaur,
15+
"emailId",
16+
],
17+
},
18+
},
19+
async run({ $ }) {
20+
const response = await this.mailosaur.deleteEmail({
21+
emailId: this.emailId,
22+
});
23+
$.export("$summary", `Successfully deleted email with ID ${this.emailId}`);
24+
return {
25+
success: true,
26+
emailId: this.emailId,
27+
};
28+
},
29+
};
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
import mailosaur from "../../mailosaur.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "mailosaur-search-email",
6+
name: "Search Email",
7+
description: "Search for received emails in a server matching specified criteria. [See the documentation](https://mailosaur.com/docs/api/#search-for-messages)",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
mailosaur,
12+
serverId: {
13+
propDefinition: [
14+
mailosaur,
15+
"serverId",
16+
],
17+
},
18+
receiveAfter: {
19+
propDefinition: [
20+
mailosaur,
21+
"receiveAfter",
22+
],
23+
optional: true,
24+
},
25+
page: {
26+
propDefinition: [
27+
mailosaur,
28+
"page",
29+
],
30+
optional: true,
31+
},
32+
itemsPerPage: {
33+
propDefinition: [
34+
mailosaur,
35+
"itemsPerPage",
36+
],
37+
optional: true,
38+
},
39+
dir: {
40+
propDefinition: [
41+
mailosaur,
42+
"dir",
43+
],
44+
optional: true,
45+
},
46+
sentFrom: {
47+
type: "string",
48+
label: "Sent From",
49+
description: "The full email address from which the target message was sent.",
50+
optional: true,
51+
},
52+
sentTo: {
53+
type: "string",
54+
label: "Sent To",
55+
description: "The full email address to which the target message was sent.",
56+
optional: true,
57+
},
58+
subject: {
59+
type: "string",
60+
label: "Subject",
61+
description: "The value to seek within the target email’s subject line.",
62+
optional: true,
63+
},
64+
body: {
65+
type: "string",
66+
label: "Body",
67+
description: "The value to seek within the target message’s HTML or text body.",
68+
optional: true,
69+
},
70+
match: {
71+
type: "string",
72+
label: "Match",
73+
description: "If set to `ALL` (default), only results matching all criteria will be returned. If set to `ANY`, results matching any criteria will be returned.",
74+
options: [
75+
"ALL",
76+
"ANY",
77+
],
78+
default: "ALL",
79+
optional: true,
80+
},
81+
},
82+
async run({ $ }) {
83+
const response = await this.mailosaur.searchMessages({
84+
serverId: this.serverId,
85+
receiveAfter: this.receiveAfter,
86+
page: this.page,
87+
itemsPerPage: this.itemsPerPage,
88+
dir: this.dir,
89+
sentFrom: this.sentFrom,
90+
sentTo: this.sentTo,
91+
subject: this.subject,
92+
body: this.body,
93+
match: this.match,
94+
});
95+
96+
$.export("$summary", `Successfully retrieved ${response.items.length} email(s) from server.`);
97+
return response;
98+
},
99+
};

0 commit comments

Comments
 (0)