Error while sending email using Outlook - erorr in Subject Line

Hi
I am trying to send email using Outlook Mail Message, but I ma getting the following error.
“The Specified String is not in the form required for the subject”
When I take the text specified for the subject in Message Box, it will show correctly, but while sending email it throws the error.

The Subject mentioned is :
SubjectLineHeader+" Error" +“-”+“Run Number: “+item.ToString
In Message Box, it shows like :”[Project RPA] Error- RunNumber: 1”

Here , if I remove the item.ToString from Subject line, then it works fine, but I need those dynamic variables in my Subject.

Can anyone please help if I am missing anything.

Thanks!!

Hello,

Item is Int32 or string variable ?

Thanks

item is Int32

possible to share screen shot of your work flow.

use writeline activity to print subject in output panel

Yes, I printed in Writeline, it shows
“[Project Violet RPA] Error. Run Number: 1”
not sure why the error is coming.

possible to share your xaml file

I think the item is null at somepoint.

Can you please try it as

if String.IsNullOrEmpty(item.ToString) Then
subjectVariable = SubjectLineHeader+" Error" +“-”+“Run Number: Null item"
Else
subjectVariable = SubjectLineHeader+" Error" +“-”+“Run Number: “+item.ToString

And use the subject variable in the Subject

sharing the file wont be possible.
The same code works in the body of the email but in the Subject line, it gives the error.

“Run Number:”+item.ToString, this works in body but not in the Subject Line

put subject line in one variable with as below :

SubjectHeader = convert.tostring (SubjectLineHeader + "Error. " + "Run Number : " + item.tostring.trim()).Replace(‘\r’, ’ ‘).Replace(’\n’, ’ ')

and put this subjectheader variable in subject of Outlook mail.

Please try this and let me know

Thanks.

hey it worked,
I just used: SubjectHeader = convert.tostring (SubjectLineHeader + "Error. " + "Run Number : " + item.tostring.trim()) and took all the text in one variable, and used that variable in Subject Line.
Thanks a Lot.

happy Learning!!

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