Solved

SMTP connector fails in process flow with process variable as expression


Userlevel 2
Badge +3

I am trying to send an email to the employee through SMTP connector in a process flow. It works fine with constant value as input (To Recipient) field and receiving the email too. When i tried input with process variable as expression, it is showing error, status code -1. How can i make it work? In my use case, each time the email id will be different, that expression should pick the correct email id but it fails to do so. 

icon

Best answer by Mark Jongeling 24 June 2022, 15:56

View original

This topic has been closed for comments

7 replies

Userlevel 7
Badge +23

Hi Usha,

Is there a particular reason to do this in a Default value query instead of a Process procedure on the Start table task process action?

Could you also share a screenshot selecting the SMTP connector process action in the Process flow monitor? I'm interested in the values for the input parameters: 

 

Userlevel 2
Badge +3

Mark, i have attached the screen shot you have asked for. 

 

Userlevel 2
Badge +3

For your previous question, for testing purpose i have added a task to trigger the process. In my actual scenario, i wanted to check a date field, if the condition is true, it should send email to corresponding person. Planning to do it by scheduling the process flow everyday.

Userlevel 7
Badge +23
Missing value

This is most likely the issue. There's currently no one that will receive the e-mail. The SMTP connector will fail when no TO recipients are given.

In my use case, each time the email id will be different, that expression should pick the correct email id but it fails to do so.

It's better to do this inside Process procedure logic (f.e. Decision process action or on the Start table task process action). Here you can also make sure your process flow stops when no e-mail has to be send. EDIT: since this will be a system flow, use a Decision node 😄

Hope this helps!

Userlevel 2
Badge +3

Mark, thanks for your reply, the issue is the expression was returning more than one values, so it did not take any value at all. Worked on the query and now getting the email. 

Userlevel 7
Badge +23

You can use the function STRING_AGG to squash the double records into one. This will allow e-mails to be send to multiple e-mail addresses. 😁

string_agg(ed.email_id, '; ')

Userlevel 2
Badge +3

Thanks Mark! Sure i will try this.👍