1

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.

VoidKing
  • 6,282
  • 9
  • 49
  • 81
  • what message is displaying with `telnet yourIPserver 465` on command prompt ? – BrOSs Oct 30 '12 at 15:29
  • Sure, just type `telnet yourIPserver 465` in CMD and tell me the response. Should be 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` – BrOSs Oct 30 '12 at 15:40
  • @BrOSs 'telnet' is not recognized as an internal or external command – VoidKing Oct 30 '12 at 15:48
  • @BrOSs That's what it says when I type it in – VoidKing Oct 30 '12 at 15:51
  • @BrOSs Also, I'm not sure what you mean by yourIPserver. You don't mean "smtp.gmail.com" do you? – VoidKing Oct 30 '12 at 15:54
  • Sorry, I assumed that you had Telnet Service available.. you could enable telnet [here](http://www.askdrtech.com/solutions/post/How-to-Enable-Telnet-Client-on-Windows-7.aspx) (if you are running windows 7). About the command, is pretty straight-fwd. With yourIPserver I meant the host machine where your SMTP server is. – BrOSs Oct 30 '12 at 15:58
  • @BrOSs So you mean "smtp.gmail.com"? Isn't that the smtp server I am trying to use. The account that is setup for this uses something like this "someName@oklecity.net" which is managed through gmail. – VoidKing Oct 30 '12 at 16:01
  • Yeah, if Google is handling your server try `telnet smtp.gmail.com 465` so.. Anyway, I think gmail is working with port 587 instead. – BrOSs Oct 30 '12 at 16:09
  • @BrOSs Really? We looked this port up yesterday (my boss knew where to go) but, perhaps the info was outdated? – VoidKing Oct 30 '12 at 16:12
  • Well, some weeks ago I used the gmail smtp services for a web application for intranet proposes. It worked out fine. – BrOSs Oct 30 '12 at 16:14
  • @BrOSs Well, when I telneted on port 465 the cmd prompt went blank. When I telneted on 587, it says this: 220 mx.google.com ESMTP nd14sm926849obb.14 – VoidKing Oct 30 '12 at 16:14
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/18804/discussion-between-bross-and-voidking) – BrOSs Oct 30 '12 at 16:16
  • King, what if we move this conversation to another place? "Please avoid extended discussions in comments" damn.. the chatroom is firewalled where I'm working right now. mailme: brossdmg at gmail. – BrOSs Oct 30 '12 at 16:17

2 Answers2

3

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.

BrOSs
  • 909
  • 4
  • 10
  • 27
0

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.

Community
  • 1
  • 1
ZombieSheep
  • 29,603
  • 12
  • 67
  • 114
  • But isn't that what WebMail.UserName, WebMail.Password, and WebMail.From is for? All of those are set... – VoidKing Oct 30 '12 at 15:49
  • I need to do this is WebMatrix which is slightly different than raw C#. I mean I know that I can write simple .cs files in WebMatrix, but I wouldn't know when and under what circumstances to call them in this case, as I am a noob at this 'setting up ssl and email' stuff – VoidKing Oct 30 '12 at 15:56