KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've been trying for a whlie on this, and have so far been failing miserably. My most recent attempt was lifted from this stack code here: Sending email through Gmail SMTP server with C# , but I've tried all the syntax I could find here on stack and elsewhere. My code currently is: var client = new SmtpClient("smtp.gmail.com", 587) { Credentials = new NetworkCredential("me@gmail.com", "mypass"), EnableSsl = true }; client.Send("me@gmail.com","me@gmail.com","Test", "test message"); Running that code gives me an immediate exception "Failure sending mail" that has an innerexeption "unable to connect to the remote server". If I change the port to 465 (as gmail docs suggest), I get a timeout every time. I've read that 465 isn't a good port to use, so I'm wondering what the deal is w/ 587 giving me failure to connect. My user and pass are right. I've read that I have to have POP service setup on my gmail account, so I did that. No avail. I was originally trying to get this working for my branded GMail account, but after running into the same problems w/ that I thought going w/ my regular gmail account would be easier... so far that's not the case.
Tags (comma-separated)
Save Edits
Cancel