Sending an email with an attachment

You can send an email with a fixed subject and fixed text, and an attachment, to a static list of recipients.

About this task

You can configure an EmailOutput node to send an email with a single attachment. To send an email with multiple attachments, see Producing dynamic email messages.

Use the IBM® App Connect Enterprise Toolkit to configure the properties on the EmailOutput node so that you can send an email with a statically defined subject and text, and an attachment, to a statically defined list of recipients. This method causes the email message to be constructed as a MIME message. The subject, text, and list of recipients remains static, but the content of the attachment is sought dynamically from the message that is passed to the EmailOutput node at run time. The location of the attachment in the message is defined statically.

Procedure

  1. Switch to the Integration Development perspective.
  2. Add an EmailOutput node to your message flow.
  3. Edit the following properties of the EmailOutput node.
    1. On the Basic tab, add the SMTP Server and Port information (for example, smtp.server.com:25).
    2. On the Email tab, add the email addresses of recipients by using the To Addresses, Cc Addresses, and Bcc Addresses properties.
    3. On the Email tab, add the email address of the sender by using the From Address and Reply-To Address properties.
    4. On the Email tab, provide a subject for the email by using the Subject of email property.
    5. On the Email tab, provide the text of the email by using Email message text property.
    6. On the Attachment tab, set the Attachment Content property by using either an ESQL or XPath expression, referring to an element in the message tree; for example, Body.BLOB.
    7. On the Attachment tab, set the Attachment Content Name property with the name of the attachment as it appears in the email.
    8. On the Attachment tab, set the Attachment Content Type, Attachment Content Encoding, and Multipart Content Type properties to determine the type of attachment that is sent in the MIME message.
  4. Save the changes.
  5. Add the message flow to the BAR file and deploy.

Results

When a message is passed into the deployed EmailOutput node, an email is sent to the defined set of recipients, containing the subject, text, and attachment specified on the node.