Send SMTP Mail Message - System exception.The specified string is not in the form required for a subject

I wonder if I can get some advice here. My automation (placed in a framework) is supposed to send an email in some circumstances, however, from time to time the activity “Send SMTP Mail Message” breaks - the log then states: “System exception.The specified string is not in the form required for a subject.” The message subject is: “File " +locationPath +” has not been located." where “locationPath” is a variable storing the file path. What could be the reason? Thank you in advance for your help!

Hi @PAD,

The subject may require string format and the file path may contain "", convert the filepath variable to string and try again.


Here were my thoughts.
There could be a character limit for the Subject or an invalid character in the file path.
If you output the Subject you use right before the error occurs, then you can take that string and hardcode it and figure out what’s causing the error.

Or provide what the string is and maybe we can identify the issue.

Hi @PD2,
The variable locationPath is in a string format already.

which character would be invalid for a subject? I have tested the string length and normally I can email this file path together with the other parts of the coded subject to myself.

Well if you are looping through many locationPaths, then you would want to check that the locationPath has a value right before the error occurs, and see what value it was. If you know what string is causing the error, that will help identify the issue. It’s probably something simple.

@PD2 and @ClaytonM, thank you for your input, guys! It seems that the problem is of a different nature though - “Take screenshot” activity has revealed that from time to time the robot operates so slowly that it moves to the next activity without ending typing in the whole string, which is placed just partially in the field - hence "The specified string is not in the form required for a subject.” I guess that “Delay” should solve the issue…

This confused me, because I thought you were using the Send SMTP. So I guess my question is where are you trying to type that requires a certain format? It is also good practice to use Retry Scopes around certain input boxes (mainly the SaveAs dialogs) so you can use Get Text with a Is True in the Condition part of the Retry —this will help the bot ensure you are typing in the text correctly before moving on.

Not sure what you meant by that :laughing:
I would suggest avoiding hardcoded delays though, and like I mentioned if you verify the input box is correct before moving on then it will be more dynamic. The “DelayBetweenKeys” does help too, but I wouldn’t go over 20 miliseconds on that or it becomes sluggish.

@PAD, Just validate User s Email id and Password if you are SMTP activity in studio

Hi @kapil.behera, thank you for your input! The issue is now solved: as stated somewhere above, “Type into” activity was performed so slowly (as the string was long), that the bot was moving to the following activity, cutting off a part of the string, hence “the specified string is not in the form required…”

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