Sending & Receiving Messages
Email Masks automatically route messages sent to the to their associated real email address, and can (for Internal real email addresses) send messages without exposing the users real email address.
Internal Email Masks
Inbound Message Receiving
Outbound Message Sending
// Collect the input headers, body, attachments and sender email mask id
// however makes sense for your implementation.
const senderEmailMaskId: string = emailMask.id
const emailMessageHeader: InternetMessageFormatHeader = {
from: { emailAddress: "[email protected]" }, // Must match emailMask.maskAddress
to: [{ emailAddress: "[email protected]" }],
cc: [{ emailAddress: "[email protected]" }],
bcc: [{ emailAddress: "[email protected]" }],
replyTo: [{ emailAddress: "[email protected]" }],
subject: "Example subject line",
}
const emailAttachment: EmailAttachment = {
filename: "fooAttachment.pdf",
contentId: uuid.v4(),
mimeType: "application/pdf",
inlineAttachment: false,
data: // ... Some pdf data
}
const inlineAttachment: EmailAttachment = {
filename: "fooImage.png",
contentId: uuid.v4(),
mimeType: "image/png",
inlineAttachment: true,
data: // ... Some image data
}
try {
const input: SendMaskedEmailMessageInput = {
senderEmailMaskId: senderEmailMaskId,
emailMessageHeaders: emailMessageHeader,
body: "An example email body",
attachments: [emailAttachment],
inlineAttachments: [inlineAttachment],
}
const result = await emailClient.sendMaskedEmailMessage(input)
// `result` contains the identifier and created timestamp associated with the sent email message. You can use this to access the data of the email message.
} catch {
// Handle/notify user of error
}
External Email Masks
Inbound Message Receiving
Outbound Message Sending
Last updated