Please try the following:
public static void SendMailMessage(string smtpHost, MailAddress from, string to, string subject, string message, MailPriority Priority, Encoding Encode)
{
try
{
MailMessage mailMsg = new MailMessage();
result = to.Split(charSeparators, StringSplitOptions.RemoveEmptyEntries);
for (int count = 0; count < result.Length; count++)
{ mailMsg.To.Add(new MailAddress(result[count])); }
mailMsg.From = from;
mailMsg.Subject = subject;
mailMsg.Body = message;
mailMsg.Priority = Priority;
mailMsg.BodyEncoding = Encode;
SmtpClient smtpClient = new SmtpClient(smtpHost);
smtpClient.Send(mailMsg);
}
catch (Exception)
{
}
}
Parameter Value reading from config file are as follows
<add key="Email.Recipient" value="John.Smith@abc.com, Joe.Wilson@abc.com" />
<add key="Email.Sender" value="Bob.Jones@xyz.com " />
<add key="Email.Copy" value="mycclist@xyz.com" />
<add key="Email.Priority" value="MailPriority.Normal "/>
<add key="Email.Encoding" value="Encoding.ASCII"/>
<add key="Email.Subject" value=".NET Email Utility Sample"/>
<add key="Email.Message" value="This email provides an example of sending a .NET email using C#."/>
<add key="Email.Smtp" value="mailhost.xyz.com" />