EDIT: This question is pointless, except as an exercise in red herrings. The issue turned out to be a combination of my idiocy (NO ONE was being emailed as the hos
Put in addresses this code:
objMessage.To.Add(***addresses:=***"email1@yahoo.com , email2@aol.com , email3@gmail.com")
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Mail;
using System.Web;
namespace HMS.HtmlHelper
{
public class SendmailHelper
{
//Created SendEMail method for sendiing mails to users
public bool SendEMail(string FromName, string ToAddress, string Subject, string Message)
{
bool valid =false;
try
{
string smtpUserName = System.Configuration.ConfigurationManager.AppSettings["smtpusername"].ToString();
string smtpPassword = System.Configuration.ConfigurationManager.AppSettings["smtppassword"].ToString();
MailMessage mail = new MailMessage();``
mail.From = new MailAddress(smtpUserName, FromName);
mail.Subject = Subject;
mail.To.Add(FormatMultipleEmailAddresses(ToAddress));
//mail.To.Add(ToAddress);
mail.Body = Message.ToString();
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Port = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["smtpserverport"]);
smtp.Host = System.Configuration.ConfigurationManager.AppSettings["SmtpServer"]; /
smtp.Credentials = new System.Net.NetworkCredential(smtpUserName, smtpPassword);
smtp.EnableSsl = Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["ssl"]); ;
smtp.Send(mail);
valid = true;
}
catch (Exception ex)
{
valid =false ;
}
return valid;
}
public string FormatMultipleEmailAddresses(string emailAddresses)
{
var delimiters = new[] { ',', ';' };
var addresses = emailAddresses.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
return string.Join(",", addresses);
}
}
}``