One of the strengths of Automation Workshop is a possibility to replace batch files and PowerShell scripts with automated Tasks. The tasks can be launched by an automatic trigger or manually. Some examples:
- trigger when a new file appears in the folder;
- trigger using Task Scheduler;
- start from a Desktop shortcut.
This tutorial will show in a step-by-step manner how to create a Task to send emails with attachments. Let us suppose we want to:
- send all
C:\My Pictures\folder to
- and move these image files to
What steps we need to take to create a Task? Let us see what steps we need to take to create a Task which will send all .jpg images over the email.
- First, we will need to create a new Task in the Task Wizard.
- We will be launching this Task manually, and I will cover an automatic start of tasks later in this tutorial. So, currently do not add any triggers to this task.
- Second, we have to add and configure an Action that will send images as email attachments.
- Finally, we will need to add an Action that will move image files from
Create a Task
How to create a Task? First, you will need to create a new Task.
- Open the Automation Workshop Manager and choose New Task…
- The Task Wizard will open. Click Next after reading the Welcome screen.
- We will start this task from a Desktop shortcut, so skip the Triggers tab by clicking Next.
- Now we are in the Actions tab.
How to add and configure an Action that will send emails with attachments? Adding Actions is easy.
- Once in the Actions tab, click the Add button. The list of all available Actions will open in a new Add Actions window.
- Since we need an Action that sends emails, let us click on the Email category and choose Send Email Action. When selected, click OK to start configuring the Send Email Action.
When configuring Send Email Action you will have to provide the same basic data as when using any other email client. Namely, to specify:
- sender's and recipient's email addresses;
- email subject field as well as email body text;
- fields From, To and Subject.
How to add an attachment? Now, when you have specified from which address the email will be sent and who will be its recipient as well as subject text, let us see how to add an attachment.
- Click the mouse on Attachments input line to put the cursor into it.
- Additional buttons will be shown, namely, Browse button and Variable Wizard button.
- Click on Browse button, then go to
C:\My Pictures\and choose any
How to add all jpg files as attachments? The Attachment line will show the path and file name (e.g., something like this:
C:\My Pictures\Sunset.jpg). If we leave it as it is, each time the email is sent, Send Email Action will try to attach exactly this image, namely,
However, we need to attach all image files. That is why we need to replace the file name (i.e.,
Sunset.jpg) with a file mask
*.jpg (all jpg files), so that Attachments field contains
C:\My Pictures\*.jpg (instead of the initial
If the default email server is configured correctly, the configuring of the Send Email Action for the Task at hand is finished. Note that it is possible to specify a different SMTP server for each instance of the Send Email Action.
Click OK to confirm all changes we have made for the Send Email Action, and we are back in the Actions tab of the Task Wizard where we can add another Action.
How to add and configure an Action that will move files to another folder? Most likely, when sending email with jpeg images, there is no reason to send the same images to the same email address again and again. To avoid that, we can add an Action that will move all jpeg files from
C:\My Pictures\ to
C:\Sent Pictures\ folder, after email is sent.
Since we are still in the Actions tab of Task Wizard, let us just click the click Add button again. This time we need to perform file operations, so we:
- open File & Folder category;
- select Move File Action;
- and click OK to open its properties.
Move File Action allows moving one or multiple files from one location to another. First, we need to fill the Source field—which files will be moved. Similarly as we did when configuring Send Email Action, in the Source field specify
C:\My Pictures\*.jpg (meaning, all .jpg files in
C:\My Pictures\ folder).
Now, let us click on the Destination input line and select
C:\Sent Pictures\ folder as a destination. The configuration of the Move File Action is completed. Click OK to return to the Task Wizard and complete a few remaining steps (give Task a name, choose reports options, etc.).
The Task is ready! Since it has no Triggers, it will not start automatically. Every time you execute the Task manually, it will attach all
.jpg files currently in
C:\My Pictures\ folder to email, and send it to specified email address.
After finishing with email sending, the Task will continue with the Move File Action, which will move all
.jpg images from
C:\My Pictures\ to
C:\Sent Pictures\ folder, in order to avoid sending of the same images again upon next Task execution.
Start the Task?
How can I start the Task? Both automatic and manual Tasks can be executed manually, yet automatic Tasks frequently depend on variable data from their Triggers. In order to diminish accidental launches, Run Task is not the default option when double clicking on Task (instead, it will open Task properties).
To run the Task manually you will have to select the Task in Task Pane of Automation Workshop Manager, and use one of the following methods:
- Create a Desktop shortcut for the task, and launch it from your Desktop.
- Click on the Run button on the Task toolbar.
- Press CTRL+F5 keyboard shortcut.
We have created a Task that does not contain any automatic Triggers and, as a consequence, can be executed only manually. When executed, the Task will locate all
.jpg image files in
C:\My Pictures\ folder and attach them to email. After sending the email with attached images, the Task will move image files to
C:\Sent Pictures\ folder.
Send email automatically
Instead of running Tasks manually, add a Trigger to start the Task automatically. There are a lot of ways to start a task without any human interaction. The email with attachments will be sent even when no one is sitting in front of a computer.
A built-in Task Scheduler Trigger works similarly like Windows Task Scheduler. It starts a task at predefined times. Task Scheduler is useful when you want your emails to be sent every hour, once a day, on Mondays, etc.
A File & Folder Watcher Trigger allows sending emails when a new file appears in the folder. It allows attaching files that triggered the task. See it in action: How do I automatically email files in a folder?
Other ways to start a Task:
Configure SMTP server
To send email, Automation Workshop needs an outgoing mail server. SMTP protocol is industry standard for email sending. The SMTP mail server can be configured in the Server tab or in the Automation Workshop Options.
Still have a question?
If you have any questions, please do not hesitate to contact our support team.