I am trying to send email from my .net console app and my app blows up with an error "rely denied"
I know that my email provider uses smtp authentications and I am trying to authenticate to server, but for some reason I am not able to.
I posted this issues multiple times unfortunately still haven't found resolution to it. I am able to send email withing my internal domain, but nothing externally.
I looked at some post where people suggest I use the following syntax and add filed to my mail message, but I am not able to come up with the proper syntax e.g. mail.Fields.Add("dsdsdsds");
Here is the code I am using to send an email:
System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage("xxx@localdomain.com", "xxxx@externaldomain.com", "test", "body");
mail.IsBodyHtml = true;
System.Net.Mail.SmtpClient exchange = new System.Net.Mail.SmtpClient("Smtp.host.net");
exchange.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
exchange.Credentials = new System.Net.NetworkCredential("xxxx", "xxxx");
exchange.Send(mail);
Any help will be greatly appreciated.
Thanks