Why I use google smtp cannot send out email?

I'm not sure what is causing your problem. Here is some code I have been using to successfully send email through a gmail account: const string from = "..."; var fromAddr = new MailAddress(from, "Bug Tracker"); var toAddr = new MailAddress("...@...", "..."); var client = new SmtpClient { Host = "smtp.gmail. Com", Port = 587, EnableSsl = true, DeliveryMethod = SmtpDeliveryMethod.

Network, UseDefaultCredentials = false, Timeout = 30 * 1000, Credentials = new NetworkCredential(fromAddr.Address, "...") }; using (var msg = new MailMessage(fromAddr, toAddr)) { msg. Subject = "..."; msg. Body = string.

Format("username: {0}\nversion: {1}\n\n{2}", Environment. UserName, Assembly. GetExecutingAssembly().GetName().Version.

ToString(3), cbtext); client. Send(msg); }.

This is the exact code that I had used in the past, but with Google's recent conversion to their "shared" setup for google apps mail, this appears to have stopped working, getting the error that the OP is getting. – Charles Boyung May 1 at 21:02 @Charles Boyung: It worked as of April 19, 2011. The system sends me an email with a stack trace whenever there's an unhandled exception.

So it's a rare event. I will test it again. – Ferruccio May 2 at 11:13 I just tested it.

It's still working. Perhaps the problem is in the gmail settings. – Ferruccio May 2 at 11:27 Has your google apps domain been converted yet?

Wondering if the conversion changes something. – Charles Boyung May 3 at 15:51 I'm not sure what you mean by "google apps domain". I'm not using google apps, just a gmail account.

– Ferruccio May 3 at 15:58.

As far as I remember by default UseDefaultCredentialsProperty is set to true. So that could cause the authentification error you've got. Try to add these lines from the previous answer to your code SmtpServer.

DeliveryMethod = SmtpDeliveryMethod. Network; SmtpServer. UseDefaultCredentials = false; I've experienced couple of weird exceptions if not set DeliveryMethod property explicitly.

Thanks! It Works! – spspli May 5 at 18:29.

I had the code that Ferruccio posted and this recently stopped working. I moved my settings into the . Config file for my site and it started to work again.

I'm not sure what is causing your problem. Here is some code I have been using to successfully send email through a gmail account.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions