This project is read-only.

SmtpClient. Suggestion for separators in mailAddressList

Feb 20, 2013 at 5:13 PM
Higty, when users type their addresses list in a textbox before sending an email, they usually use the semi-column as separator, just as they would do with Outlook.

As a suggestion and a helper for developpers, I suggest an automatic replacement of ';' with ',' when parsing mailAddressList. That would avoid repeatedly coding this:

this.To.AddRange(HigLabo.Net.Mail.MailAddress.CreateMailAddressList(mailAddressListText.Replace(";", ",")));

Feb 20, 2013 at 11:43 PM
Thank you for your proposal.
I'll add CreateMailAddressList method overload like below in next release.

public static List<MailAddress> CreateMailAddressList(String mailAddressListText, Char separator) {...}

You can use it as below.
var list = MailAddress.CreateMailAddressList("..your mail address list..", ';');

Feb 21, 2013 at 8:41 AM
Ohayo gozaimasu,

Why not just assume that we don't know what separator we are going to receive, and automatically Replace the semi-column with a coma?
I can see no drawback. Both are incorrect characters if the users means to include them inside an adress or if they type them by error. I can see no security issue either.
So I think that an automatic replace would makes sens in all cases. What do you think?
Feb 21, 2013 at 11:34 AM

I think you are right.I had bad idea.
I'll automatically handle both char as separator.
Thank you for your review.

Feb 27, 2013 at 12:36 AM
I uploaded new version and fix CreateMailAddressList method.