MCPcopy Create free account
hub / github.com/pollinations/pollinations / sendBulkEmail

Function sendBulkEmail

apps/micro/examples/nextjs-example.js:83–116  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

81
82// Example 4: Send to multiple recipients
83async function sendBulkEmail() {
84 try {
85 console.log('📧 Sending bulk email...');
86
87 const response = await fetch(`${API_BASE_URL}/email/send`, {
88 method: 'POST',
89 headers: {
90 'Content-Type': 'application/json',
91 },
92 body: JSON.stringify({
93 to: ['user1@example.com', 'user2@example.com', 'user3@example.com'],
94 subject: 'Important Update',
95 html: `
96 <div style="font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto;">
97 <h1 style="color: #333;">Important Update</h1>
98 <p>Dear valued user,</p>
99 <p>We have an important update regarding our service.</p>
100 <p>Best regards,<br>The Pollinations AI Team</p>
101 </div>
102 `,
103 }),
104 });
105
106 const data = await response.json();
107
108 if (data.success) {
109 console.log('✅ Bulk email sent successfully!', data.messageId);
110 } else {
111 console.error('❌ Failed to send bulk email:', data.error);
112 }
113 } catch (error) {
114 console.error('❌ Error:', error.message);
115 }
116}
117
118// Example 5: Test with different providers
119async function testProviders() {

Callers 1

runExamplesFunction · 0.70

Calls 5

logMethod · 0.80
stringifyMethod · 0.80
jsonMethod · 0.80
errorMethod · 0.80
fetchFunction · 0.50

Tested by

no test coverage detected