One thing you should do though is identify which part is causing the issue. For example, is it the Add Attachments part in the For loop or is the ForwardMessage in the Send SMTP? You can verify that the Add Attachments work by outputting the list:
Think that will work. If the list of files are correct, then you know it must be the ForwardMessage that is messing it up. I’m thinking if that’s the case, then it must be a bug with that feature rather than a coding issue, but I still suspect the special character is not working right.
You could also try replacing the special character with Char(38) or &
The thing with the attachments though is that they are being correctly identified and attached, BUT, they’re being attached to an email which is then what UiPath seems to forward me. So the email I want to receive I am essentially being forwarded instead of sent, creating an email within an email.
But now as I’ve removed the To/Subject etc from SMTP the previously “correct” email is now showing blank (but with correct attachments, subject and attachments:
String.Join(",",mailFPAEmail.Attachments.Select(Function(x) x.Name))
Should be used to verify filenames.
By the way, I tested using the Forward message property on my end (using your code) and it sent the filenames correctly with an ampersand. So I’m starting to think it’s not a bug with the feature.
I can live with the filenames not showing & for now, it’s more than when trying to fix the & issue (without touching the SMTP activity that I’m aware of, I’m now getting some sort of email within an email inception situation?
You know what, it could also be an issue with your version of Outlook or SMTP server. Seems like others have reported similar issues, outside of UiPath. Google Search
I will get our IT guys to look into the version of our SMTP server then in regards to this file name issue, thanks!
Is there any chance you’d know why it also won’t send the email properly to begin with, and why it buries the attachments in a secondary email which it then forwards? Cheers!
But why doesn’t it work for me? It did once, the very first time, and since then has forwarded instead of directly sending attachments?
Surely there’s a very easy way for UiPath to send an email via SMTP which has a defined Subject/To/CC and the attachments, all from the variable I have set up, as that’s the point of it I thought, without having to forward anything?
Your code worked for me and did not embed the message in another email, and since you say it worked the first time, then I’m thinking that maybe an update to your environment changed something.
So the code I uploaded at the top worked, ok, I’ll just redownload that and try again from there, maybe too much playing around my end has changed something I didn’t realise.
Thanks guys!! But now it’s the weekend, beer time, cheers!