Sample SMTP Session with Auth Login

by Oliver 13. June 2013 15:27

This post is most of all a log drop of an SMTP session I had with our mail server over telnet.

We use hMailServer for all of our own and hosted e-mail accounts. Today, I set up a new account to use for our SQL servers to report any problems. I couldn't get SQL Server's DatabaseMail to successfully send any e-mail so I went to find out what might be wrong by myself. Here's my first successful chat with our mail server using AUTH LOGIN, i.e. username and password authentication:

   1: 220 mail.teamaton.com ESMTP                                   // started session with: telnet mail.teamaton.com 25
   2: hello                                                         // my first try - not quite ;-)
   3: 502 Use HELO/EHLO first.
   4: HELO                                                          // ok, I got you
   5: 501 HELO Invalid domain address.
   6: HELO                                                          // say again?
   7: 502 Use HELO/EHLO first.
   8: EHLO 25.0.153.55                                              // send a host name of the computer you're on
   9: 250-mail.teamaton.com
  10: 250-SIZE 15000000
  11: 250 AUTH LOGIN
  12: MAIL FROM: <sql*******@teamaton.com>                          // the from address to use for the e-mail
  13: 250 OK
  14: RCPT TO: <oliver*******@******.com>                           // trying to set a recipient's address
  15: 530 SMTP authentication is required.
  16: AUTH LOGIN                                                    // initiating login
  17: 334 VXNlcm5hbWU6                                              // the server is asking for my username in base64 encoding
  18: c3FsLXNl***************vbi5jb20=                              // sending my username in base64 encoding
  19: 334 UGFzc3dvcmQ6                                              // the server is asking for my password in base64 encoding
  20: YkZwN***************A1dng=                                    // sending my password in base64 encoding
  21: 535 Authentication failed. Restarting authentication process. // oops, I copied some invisible character from that encoding web page
  22: auth login                                                    // try again
  23: 502 Unimplemented command.                                    // case seems to matter
  24: AUTH LOGIN
  25: 334 VXNlcm5hbWU6
  26: c3FsLXNl***************vbi5jb20=
  27: 334 UGFzc3dvcmQ6
  28: YkZwN***************A1dng=
  29: 235 authenticated.                                            // finally!
  30: DATA                                                          // set the body of the e-mail
  31: 503 Must have sender and recipient first.                     // hm, I thought I set the sender already…
  32: MAIL FROM: <sql*******@teamaton.com>                          // oh well, set it again
  33: 503 Issue a reset if you want to start over                   // I didn't want to start over!
  34: RCPT TO: <oliver*******@******.com>                           // set only the missing recipient, then
  35: 250 OK
  36: DATA                                                          // now, set the mail body
  37: 354 OK, send.
  38: Test mail here.
  39:  
  40: .                                                             // mark the end of the mail body
  41: 250 Queued (11.247 seconds)
  42: 421 Connection timeout.                                       // that's what happened after a while when I left the shell open
  43:  
  44: Connection to host lost.
  45:  
  46: C:\Users\Oliver>

Every line that starts with a status code was sent by the server, the rest of them is what I entered.

Just for the record.

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

About Oliver

shades-of-orange.com code blog logo I build web applications using ASP.NET and have a passion for jQuery. Enjoy MVC 4 and Orchard CMS, and I do TDD whenever I can. I like clean code. Love to spend time with my wife and our daughter. My profile on Stack Exchange, a network of free, community-driven Q&A sites

About Anton

shades-of-orange.com code blog logo I'm a software developer at teamaton. I code in C# and work with MVC, Orchard, SpecFlow, Coypu and NHibernate. I enjoy beach volleyball, board games and Coke.