Dieser Inhalt liegt nicht in Ihrer Sprache vor. Hier ist die englische Version.
Configuring the Job for sending an email with attachment in HTML format
Before you begin
The following four context variables have been created:
SMTPHost: the IP address of the SMTP server used to send
emails
SMTPPort: the port number of the SMTP server used to send
emails
SMTPUserName: the username required for connecting to the
SMTP server
SMTPPassword: the password required for connecting to the
SMTP server
Procedure
Double-click the tCreateTemporaryFile component to open
its Basic settings view, select the Use
default temporary system directory check box and clear the
Use prefix check box.
Double-click the tRowGenerator component to open its row
generator editor, in the Number of Rows for RowGenerator
field, enter the number of rows to be generated, 5 in
this example.
Click the [+] button to add two columns:
empno of Integer type, using
Numeric.sequence(String,int,int) from the
Functions list to generate sequence
numbers
name of String type, using
TalendDataGenerator.getFirstName() from the
Functions list to generate random first
names
When done, click OK to close the dialog box.
Double-click the tFileOutputDelimited component to open
its Basic settings view, in the File
Name field, press Ctrl+Space and from the
global variable list displayed, select
((String)globalMap.get("tCreateTemporaryFile_1_FILEPATH")).
Double-click the tSendMail component to open its
Basic settings view.
Enter the emails of the receiver and the sender in the
To and From fields
respectively.
In the Message field, enter the HTML body message of the
email.
"<html><body>The file is located at: " +
((String)globalMap.get("tCreateTemporaryFile_1_FILEPATH")) +
". It is attached in the email for reference.</body></html>"
Click the [+] button under the
Attachments table to add a row, in the
File cell, press Ctrl+Space
and from the global variable list displayed, select
((String)globalMap.get("tCreateTemporaryFile_1_FILEPATH")).
In the SMTP host and SMTP port
fields, enter the address and the port of the SMTP server used to send emails.
In this example, context variables are used to set the value of the two
fields.
Select the SSL Support check box to enable the component
to open an SSL connection when communicating with the SMTP server.
Select the Need authentication check box, and in the
Username and Password fields,
enter the username and the password required for connecting to the SMTP server.
In this example, context variables are used to set the value of the two
fields.
On the Advanced settings view, select
HTML from the MIME subtype from the 'text'
MIME type drop-down list.
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!