Here is my problem: I wrote whe following program to test if I can send email:
class Program
{
static void Main(string[] args)
{
try {
While I had encountered the same issue, I found a solution to the issue here
In short, you must use
smtp.UseDefaultCredentials = false;
AFTER
smtp.Credentials = new NetworkCredential(ConfigurationManager.AppSettings["email.username"].ToString(),
ConfigurationManager.AppSettings["email.password"].ToString());
So quick summary, something that would look more like this should work:
SmtpClient smtp = new SmtpClient();
smtp.Host = ConfigurationManager.AppSettings["email.smtp"].ToString();
smtp.Port = Convert.ToInt32(ConfigurationManager.AppSettings["email.port"]);
smtp.Credentials = new NetworkCredential(ConfigurationManager.AppSettings["email.username"].ToString(),
ConfigurationManager.AppSettings["email.password"].ToString());
smtp.UseDefaultCredentials = false;
smtp.EnableSsl = Convert.ToBoolean(ConfigurationManager.AppSettings["email.enablessl"]);
Console.WriteLine("Sending email..." + (i+1));
smtp.Send(mail);