Question

I am trying to get WebMatrix running on a local server (simply for testing within our intranet), but it is having trouble sending mail where it never did before on my local (work) machine.

I am getting a simple, the operation has timed out message. The account for this is setup through gmail, so I wouldn't think that there would be too many problems, but as I have never set up WebMatrix on a server before, I don't really know how to attack this issue.

When I had the Email working in construction of this website, I used these settings and everything worked fine:

WebMail.SmtpServer = "smtp.gmail.com";
WebMail.SmtpPort = 25;
WebMail.EnableSsl = false;

Then when I ran it with these settings on the server I got this error:

The SMTP server requires a secure connection or the client was not authenticated.  The server response was: 5.7.0 Must issue a STARTTLS command first.

With that, we tried to enable SSL, but get a simple response timed out request after that (using these settings):

WebMail.SmtpServer = "smtp.gmail.com";
WebMail.SmtpPort = 465;
WebMail.EnableSsl = true;

The "Username" and "From" fields are set the same (name@somecity.net) this is an example of our email that is managed by gmail. Also the password is set and correct.

Am I chasing the wrong thing here, by looking into SSL?

You'll have to forgive me in that I have never implemented SSL before. I know what SSL is, but I have never set it up before, so I apologize if I am a kind of a noob when it comes to setting this up.

Also, just so you know for sure, the server error does, in fact, error on the WebMail.Send method.

Was it helpful?

Solution

You should change your SMTP port for the Gmail one. Right now, gmail is working with 587 instead of 465.

You can check it using telnet smtp.gmail.com 587. Then you should get something like this:

220 test.auto.mySMTPserver.com ESMTP Service (Lotus Domino Release 8.5.3FP2 HF95) ready at Tue, 30 Oct 2012 08:27:31 -0700

Your new code:

WebMail.SmtpServer = "smtp.gmail.com";
WebMail.SmtpPort = 587;
WebMail.EnableSsl = true;

And that's it.

OTHER TIPS

I would say that the message tells you you are not authenticated, so you are likely to need to send a username / password for a valid user on the server. See this question for an example of authenticating to a mail server to send.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top