import {mailProvider, mailProviders: {MAILGUN}} from 'whosmysanta-js';
const {send} = mailProvider({
provider: MAILGUN,
config: {
apiKey: process.env.API_KEY,
domain: 'example.com',
},
});
send({
users: [
{
name: 'Glenn Reyes',
email: 'glenn@example.com',
organizer: 'Karl Horky',
joinUrl: 'https://example.com/join/karls-santa-group/Hk4QvBP7g',
},
{
name: 'Patrick',
email: 'patrick@example.com',
organizer: 'Karl Horky',
joinUrl: 'https://example.com/join/karls-santa-group/Yk5TwDF6e',
},
],
template: `
<html>
<table>
<tr>
<td>
Hi {user.name}
</td>
</tr>
<tr>
<td>
<a href="{user.joinUrl}">Join the group</a>
</td>
</tr>
</table>
</html>
`,
});
send({
users: [
{
name: 'Glenn Reyes',
email: 'glenn@example.com',
recipient: 'Patrick',
recipientWish: 'iPhone',
},
{
name: 'Patrick',
email: 'patrick@example.com',
recipient: 'Karl',
recipientWish: 'Google Cardboard',
},
],
template: `
<html>
<table>
<tr>
<td>
Hi {user.name}, you need to get {user.recipientWish} for {user.recipient}.
</td>
</tr>
</table>
</html>
`,
});