Use Queue item in SMTP Mail Body

Well, I don’t know whether this is possible…

I am doing automation where I have to send a Mail which consists of a format (which is in Config) where the “Name”, “Role”, and “Company Name” are saved in Queues.

So my question is, how can I use these variables which will change the mail body content respectively.

Thank You in Advance

@Anirudh_Tugawe

You want to pass that values in the body of the mail
If so you can use replace
create a dummy names like name,role and company in the body template in config.

Config(“body”).tostring.replace(“name”,yourevariable)

Is this you are expecting?

@Anirudh_Tugawe

Cool

As the body is having a constant structure have you try this way

Take assign activity

Outputstr=config(“mailbody”).tostring

Outputstr.replace(“(Name of the Candidate)”,namevariable).replace(“(Role)”,rolevariable)

Hope this helps

Hi @Anirudh_Tugawe

You can tag some words in body text then replace them with the specific content from the queue

Like this

Your body text

Following the request information 

Name: #name
Role: #role
Company Name: #company

In assign activity you can

body = body.Replace("#name", in_TransactionItem.SpecificContent("Name").ToString)
body = body.Replace("#role", in_TransactionItem.SpecificContent("Role").ToString)
body = body.Replace("#company", in_TransactionItem.SpecificContent("Company Name").ToString)

Then use body to send the email

Cheers

  1. You can get the details from queue using transactionitem.specificcontent(“KeyInQueue”) in avariable.
  2. Read the config key as Config(“MailBodyTemplate”).replace(“”,variable)

@Anirudh_Tugawe
ForEach: item in QueueItems

Assign: Name = item.SpecificContent(“Name”).ToString
Assign: Role = item.SpecificContent(“Role”).ToString
Assign: CompanyName = item.SpecificContent(“CompanyName”).ToString
Assign: MailBody = String.Format(“Hello {0},\n\nYour role at {1} is {2}.”, Name, CompanyName, Role)

Send Outlook Mail Message (or Send SMTP Mail Message)
To: “recipient@example.com
Subject: “Your Subject”
Body: MailBody

1 Like

When preparing the content / using a template in conjunction with the Create HTML Content Activity the usage of variables is supported out of the box

1 Like

this will be in “For Each”?

Hi @Anirudh_Tugawe ,

Please refer below mentioned link for the solution from techystack.

Link:- https://youtu.be/sq4sjXEp0ho?si=KZcxn973k-fnbJAI

Regards,
Pavan Kuamr

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.