Sending Emails with Attachments Loop

Hi all,

I’m trying to create a process to send out a large amount of emails with attachments.

Basically, I have a folder containing all the files to be sent out in .xlsx format, and each file is to be sent out to a different recipient.

The recipient’s email address are in a standard form, with a format along the lines of “hhXXXt@gmail.com”. The “XXX” refers to the first 3 letters/numbers of the respective .xlsx file.

This process is to be run monthly and the number of items in this folder varies from month to month, as such, how should I go about with going through with this process loop?

Thanks!

Welcome @Calvin_Woon

You can use a For Each activity with Directory.GetFiles(yourDirectory) or Directory.GetFiles(yourDirectory,"*.xlsx"). Set the TypeArgument parameter to String.

Then, you can split the filename by “\” and take the first three characters to build your email address:
file.Split("\"c).Last.ToString.Substring(0,3)

Then you just need to add “hh” before the modified string and “t@gmail.com” after it. This can all be done directly in the email activity.
image

@Calvin_Woon

I believe that email is the primary source to send those files, so based on that i have created the workflow.

I have used the below code in the outlook attachment:

Attachment +row(“Email_IDs”).ToString.Substring(2,3).ToString + “.xlsx”

I hope it meet your expectations.

Continuing the discussion from Sending Emails with Attachments Loop:

Hi all,

Thanks for your prompt replies. I’m running into a little trouble getting the port and server settings from the company’s IT department. Currently, I’m using gmail to send these attachments.

Would it be possible to perform all these actions, (composing a new email, typing in the recipient and subject, attaching the documents) in Chrome instead?

Look forward to your replies!

Hi @Calvin_Woon

Yes you can do it by using these actions using Gmail as well. Instead of using the Outlook activity you need to use the send SMTP activity and under properties select the SMTP server and port. Please refer the example snapshot. Under attach file follow the same value as i shared earlier. You can choose your subject and Body as your own. Thanks.

I would request you to mention the user name so that they get the notification on the same query whether it is resolved or still open. Thanks.