()
| 110 | |
| 111 | // Example 5: Send with attachments |
| 112 | async function sendEmailWithAttachments() { |
| 113 | try { |
| 114 | console.log('📧 Sending email with attachments via Resend...'); |
| 115 | |
| 116 | const result = await emailService.sendMail({ |
| 117 | to: 'user@example.com', |
| 118 | subject: 'Document Attached', |
| 119 | html: '<p>Please find the attached document.</p>', |
| 120 | attachments: [ |
| 121 | { |
| 122 | filename: 'document.pdf', |
| 123 | content: 'base64-encoded-content-here', |
| 124 | contentType: 'application/pdf', |
| 125 | }, |
| 126 | ], |
| 127 | }); |
| 128 | |
| 129 | if (result.success) { |
| 130 | console.log('✅ Email with attachments sent successfully!', result.messageId); |
| 131 | } else { |
| 132 | console.error('❌ Failed to send email with attachments:', result.error); |
| 133 | } |
| 134 | } catch (error) { |
| 135 | console.error('❌ Error:', error.message); |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | // Example 6: Verify Resend connection |
| 140 | async function verifyResendConnection() { |
no test coverage detected