# How to fetch email message and attachments in code
# Capturing emails
You can use MailSlurp to capture real emails and attachments in applications, tests, or using the MailSlurp Dashboard.
# Inbox routing
In order to receive emails with MailSlurp you must first create an inbox. Each inbox has an
id and an
emailAddress. Any email sent to the inbox's email address will be captured by MailSlurp and stored in the inbox.
# Listing received emails
You can see a list of all the emails an inbox has received on the overview page for a given inbox. You can also use the
getEmails(inboxId) methods in the SDKs libraries.
# Viewing email content
You can view the content of an email by clicking view in the inbox overview page or by using the
getEmail(emailId) methods in the API.
The Dashboard email overview page contains a number of sections. The first is an overview of the email including the
The body of an email is available in several formats: plain-text, HTML preview, and RAW.
# Plain Text
# HTML Preview
MailSlurp renders a real HTML preview of your email. Note some email clients may render results differently. Images are available for paid plans.
Raw SMTP email content is available under the RAW tab in the content pane. This is useful for deep email analysis.
You can capture and download real attachments with MailSlurp in code, tests, or using the Dashboard.
If an email was received that contained attachments they will be listed in the attachments section. The can also be obtains via the
downloadAttachment(attachmentId) developer endpoints.
# Spam anaysis
MailSlurp performs powerful SPAM analysis on every email. You can view the results in the email analysis section: