August 15, 2023

cMail – Docs for ESB 6.x

cMail

Sends or receives mails in a Route.

cMail provides access to Email
via Spring’s Mail support and the underlying Java Mail
system.

cMail Standard properties

These properties are used to configure cMail running in the Standard Job framework.

The Standard
cMail component belongs to the Connectivity/Internet family.

Basic settings

Protocols

List of protocols for sending or receiving mails.

Host

Host name of the mail server.

Port

Port number of the mail server.

UserName and
Password

Login authentication data. To enter the password, click the
[…] button next to the
password field, and then in the pop-up dialog box enter the password
between double quotes and click OK
to save the settings.

Subject

Subject of the mail being sent.

Content Type

The mail content type.

From

The mail sender.

To

The mail receivers.

CC

The CC recipients of the mail. Separate multiple email addresses
with a comma.

BCC

The BCC recipients of the mail. Separate multiple email addresses
with a comma.

Advanced settings

Arguments

Click the [+] button to add lines
as needed in the Arguments table.
Then, enter the name and value of an argument.

Usage

Usage rule

When used as a start component, cMail is intended to receive mails. Otherwise, it is
intended to send mails.

Limitation

Due to license incompatibility, one or more JARs required to use this component are not
provided. You can install the missing JARs for this particular component by clicking the
Install button on the Component tab view. You can also find out and add all missing JARs easily on the
Modules tab in the
Integration
perspective of your
studio. You can find more details about how to install external modules in Talend Help Center (https://help.talend.com).

Scenario: Using cMail to send and receive
mails

This scenario applies only to a Talend solution with ESB.

This scenario includes two routes. The first one sends a mail while the second
receives it.

Now we build a route to send a mail.

As shown above, the mail has been sent out successfully.

Now we build a route to receive the mail.

Mail sending

  1. Drop the components from the Palette onto the
    workspace: cFile, cMail and cProcessor,
    respectively labelled as Mail_to_send,
    Send_Mail and Mail_Sent.
  2. Link the components using a Row > Route connection.

    use_case_cmail_1.png

  3. Double-click cFile to open its Basic settings view in the Component tab.

    use_case_cmail_2.png

  4. Click the […] button next to the Path field to select the folder that has the file to
    send.
  5. In the FileName field, enter the name of the
    file to send, test mail.txt in this use case.
    Keep the default setup of other items.

    The content of this file is test mail
    body
    .
  6. Double-click cMail to open its Basic settings view in the Component tab.

    use_case_cmail_3.png

  7. In the Protocols list, select smtps.

    In the Host field, type in the host name of
    the smtp server, smtp.gmail.com in this use
    case.
    In the UserName and Password fields, enter the login authentication credentials,
    which are in the form of context variables in this example. For more information
    about context variable setup, see
    Talend Studio User
    Guide
    .
    Keep the default setting of the ContentType
    field, text/plain.
    In the To field, enter the receiver of the
    mail, which is also in the form of context variable in this example.
  8. Double-click cProcessor to open its Basic settings view in the Component tab.

    use_case_cmail_4.png

  9. In the Code box, enter the code below to give
    a prompt after the mail is sent.

  10. Save the route and press F6 to run.

    use_case_cmail_5.png

Mail receiving

  1. Drop the components from the Palette onto the
    workspace: cMail and cProcessor, respectively labelled as Receive_Mail and Mail_Body.
  2. Link the components using a Row > Route connection.

    use_case_cmail_6.png

  3. Double-click cMail to open its Basic settings view in the Component tab.

    use_case_cmail_7.png

  4. In the Protocols list, select imaps.
  5. In the Host field, type in the host name of
    the imap server, imap.gmail.com in this use
    case.
  6. In the Port field, type in the port number,
    993 in this use case.
  7. In the UserName and Password fields, enter the login authentication credentials,
    which are in the form of context variables in this example. For more information
    about context variable setup, see
    Talend Studio User
    Guide
    .
  8. Keep the default setting of the ContentType
    field, text/plain.
  9. Double-click cProcessor to open its Basic settings view in the Component tab.

    use_case_cmail_8.png

  10. In the Code box, enter the code below to
    print the mail body.

  11. Save the route and press F6 to run.

    use_case_cmail_9.png

    As shown above, the mail has been received and its content is test mail body.

Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x