Add Email addressCollection to, cc, bcc and replytoList
- by san
i want to add MailAddressCollection with to,cc,bcc and replytolist of my MailMessage(Net.Mail)
my code Like
MessageEntity.To.Add(GetMailAddress(TOEmailAddress));
MessageEntity.CC.Add(GetMailAddress(CCEmailAddress));
MessageEntity.Bcc.Add(GetMailAddress(BCCEmailAddress));
MessageEntity.RepltToList.Add(GetMailAddress(ReplyEmailAddress));
private static MailAddressCollection GetMailAddress(List<string> LstMailAddress)
{
MailAddressCollection MAddressCollection = new MailAddressCollection();
if (MailAddress != null)
{
foreach (string EmailAddress in MailAddress)
{
if (IsValidEmailId(EmailAddress))
{
MAddressCollection.Add((new MailAddress(EmailAddress)));
}
}
}
return MAddressCollection;
}
It is showing the error cannot convert from 'System.Net.Mail.MailAddressCollection' to 'string'
Is it possible to add the EmailAddressCollection to email's to/cc/bcc/ReplyToList?
Thanks
San