Invalid Character In Mail Header

Hi Devs, I am using string.join to send mails to so many recipients but I get error invalid character in mail header. please what’s the solution to this? Cause when I loop through the email and send to recipients it doesn’t throw error but when I ue String.join it throws the error.Regards

Can you what is written in String.join?

Hello @RPA-botDev
please refer to the below below posts. Make sure while joining youa re joining with “;” with email address.

This is my code -
String.Join(";", dtName.AsEnumerable.Select(Function(row) row(“Name”).ToString.Trim))
I think the problem might be that ome of the mail strings had ; already
example - ken@jobber.com;lovet@gmail.com

So how do we remove this ; already in the string before using String.Join(";", dtName.AsEnumerable.Select(Function(row) row(“Name”).ToString.Trim))

String.Join(";", dtName.AsEnumerable.Select(Function(row) row(“Name”).ToString.Replace(";","").Trim))

Try like this.

1 Like

Hi Rahu, if we replace “;” with “”, won’t it see the mail as this ken@jobber.comlovet@gmail.com;

Then you are joining with “;” ryt. Just print it in a message box and check how the result is coming.