Summary
This tutorial teaches you how to automate the task of sending an email, either to distribute a report or as a notification of script execution.
In this tutorial you will learn:
You will need:
Note: Toad Automation supports only SMTP email transmission.
The Send Email activity is an important activity in Automation. Most Automation scripts end with a Send Email activity, for example, whenever you need to share reports with end-users or send a notification of successful script execution.
Take a look at the Activity Input tab. The fields tagged with a red exclamation mark are required fields.
In the From field, click to auto-populate this field with your email address.
Note: If you encounter a security alert message from your email application, and you want to use this auto-populate feature, grant Toad access (at least temporarily).
Enter the address of your SMTP email server, or click to auto-populate this field. If Toad is unable to auto-populate this field, contact your email administrator for the SMTP email server address.
Click Add Attachments to attach one or more files to the email. The File Collection Editor opens and displays the list of files that your script creates in the activities that precede this one. In this case, the output file you specified in the Select to File activity is listed.
Click
You can use a file as the body of your email instead of entering a message in the text box.
In the Activity Input tab, in the Use file for body field, click and browse to and select the HTML file you just created.
Note: The Select File dialog opens with the HTML file type selected. To select other types of files, change the file type.
Click
Tip: If you want to use a form letter as the body of your email, you can create a form letter template and then use the Find and Replace activity to change the placeholder text to suit the purpose of your email. See Automate Find and Replace for more information.
With any script, you can instruct the script to send an email if an error occurs.
In the Activity Input tab, select the Send email when an error occurs option.
Then click Compose Email to configure the error email settings.
Click Email Server Settings to enter information about your email server.
Note: After configuring Email Server Settings in script Settings for the first time, Toad saves this information as the default values for the Send Email activity and error emails in all subsequent scripts.
It is also a good idea to select the Attach log file to email option for your error emails. This allows you to see any error messages and assists in debugging the script.
If you do get an error, it is also a good idea to change the Logging level for the error email log to Verbose. This allows you to get more detail in the log about the error and may be helpful to use if you post a question about your error in the Toad for IBM DB2 forum on Toad World.
The Send Email activity is a very useful activity. Including it in your Automation scripts is easy, and you may find that it proves to be an integral part of every script.
See Schedule Your Script to learn how to schedule the Automation script.
© 2024 Quest Software Inc. ALL RIGHTS RESERVED. Términos de uso Privacidad Cookie Preference Center