I'm trying to send a couple of emails using google SMTP server. I've been researching how to and have found plenty of articles on stackoverflow and other resources where people successfuly send email - I haven't been able to do so. Here's the code I've been using trying to contact the SMTP server:
var secureString = new SecureString(); foreach (char c in "password") { secureString.AppendChar(c); } var client = new SmtpClient("smtp.gmail.com", 587) { UseDefaultCredentials = false, DeliveryMethod = SmtpDeliveryMethod.Network, Credentials = new NetworkCredential("[email protected]", secureString), EnableSsl = true }; client.Send("[email protected]", "[email protected]", asdf", "asdf"); The exception I'm getting is saying that it's unable to contact the remote server. The innermost exception says:
"An attempt was made to access a socket in a way forbidden by its access permissions 64.233.161.109:587"
Any suggestions on what else to try?
I've tried this on three different network to ensure that this isn't a firewall issue. Using my cell phone as a hotspot I've had the same problen, which should mean that it isn't a company firewall.
465?