How a mail server works

Discussion in 'Noob Central' started by Ironmail, Aug 20, 2011.

  1. Ironmail

    Ironmail VIP

    Joined:
    Mar 8, 2011
    Messages:
    125
    Likes Received:
    9
    Trophy Points:
    18
    This is probably a post not just for the noobs, but for some of the non-technical pros as well. I found this post on about.com and it explains how a mail server works. It is pretty insightful and will let you know the basics of how it works. Great information for any mailer to have.

    http://email.about.com/cs/standards/a/smtp.htm

    -----------------------------

    When you send email SMTP comes into play. SMTP is short for Simple Mail Transfer Protocol as defined in RFC 2821: Simple Mail Transfer Protocol. Your mail client talks to the SMTP server using this clean and simple procedure to get email from one place to another.

    The Flirt

    Your email program becomes an SMTP client, connects to port 25 of your mail server (usually the SMTP port) and — says EHLO. Computers, in the end, are only human and what counts is that it wants to be polite. Actually, it does not attempt to be polite but to use later additions to SMTP that have brought about two flavors of the later HELO command (SMTP command generally consist of four characters).
    Two Flavors of HELO

    EHLO, being the more recent one makes the server advertise all the additional features (such as delivery status notification or the ability to transport messages that contain other than the safe ASCII characters) it supports.

    Not every server will allow this greeting, but it is required to accept a plain HELO which naturally assumes that no additional features are present. Both hello commands do require the client to specify its domain after the **LO, however. In practice, this looks something like:

    220 mail.domain.net ESMTP Server
    HELO
    501 HELO requires domain address
    HELO localhost
    250 mail.domain.net Hello localhost [127.0.0.1], pleased to meet you

    (My input is in italics, the servers output is black; lines beginning with a 5 indicate an error.)

    The Sender

    The remainder of the protocol really deserves the attribute simple. If you want to send an email, you start with the keywords MAIL FROM:. Following this comes the email address of the sender, as suggested by the from. Don't forget to put brackets around the address, though (like <[email protected]>). Continuing our example, we have:

    MAIL FROM: <[email protected]>
    250 [email protected]... Sender ok

    The recipient

    After the server has accepted the sender's address, the client can give the address of the recipient. The command for this action, RCPT TO: again is rather suggestive. I want to send mail to myself:

    RCPT TO: [email protected]
    250 [email protected]... Recipient ok (will queue)

    That the server will queue means just that: it will save the mail locally and send it together with all the other queued mail in intervals (for example, every 30 minutes). This behavior depends on the configuration and the server may also deliver the mail instantly.

    We're almost done. What's still missing, though, is the important part: the actual message.

    The Message

    Now that the "envelope" is finished, the data of the email message just as it is can follow. This "data" consists of the email's body as well as the header fields.

    The command to initiate the state that makes the server accept the message is DATA. Following this are all the header fields of the email message and then the body, both making up for just one big block of text (or data). To tell the server that the input is finished a dot on a line by itself is used (\r\n.\r\n). So I send my message:

    DATA
    354 Enter mail, end with "." on a line by itself
    Message-ID: <[email protected]>
    Date: Sun, 17 Aug 1997 18:48:15 +0200
    From: Heinz Tschabitscher <[email protected]>
    To: Heinz Tschabitscher <[email protected]>
    Subject: For the Summarize-Proust Contest

    Off to Swan's World!
    .
    250 SAA19153 Message accepted for delivery

    Yes, this means that you can state a name completely different from the one the email goes to in the To: field. For example, you can use "Recipient list suppressed" <[email protected]>.

    The End

    You can now send as many emails as you wish repeating the steps from MAIL FROM: to .. If you're done with that, you may quit the server with the QUIT command and that's just what we do:

    QUIT
    221 Goodbye

    How Can I do This?

    The non-trivial solution is to telnet to your outgoing mail server (you can find its address in your email client's account settings) on port 25.

    Open a command prompt.
    Type "telnet <mail server> 25".
    Talk to the server using SMTP.
    The easier way is to use this Java applet, which tries to imitate the SMTP protocol and guides you through the dialog.
     
  2. DKPMO

    DKPMO VIP

    Joined:
    Mar 31, 2011
    Messages:
    1,452
    Likes Received:
    68
    Trophy Points:
    48
    Location:
    Elaborate Underground Base
    It is actually funny how many mailers are unaware of how SMTP protocol works.
     
  3. JohnFarrell

    JohnFarrell VIP

    Joined:
    Apr 13, 2011
    Messages:
    828
    Likes Received:
    35
    Trophy Points:
    0
    I'd be hesitant to call anyone a mailer that can't explain how the SMTP protocol works lol.
     
  4. DKPMO

    DKPMO VIP

    Joined:
    Mar 31, 2011
    Messages:
    1,452
    Likes Received:
    68
    Trophy Points:
    48
    Location:
    Elaborate Underground Base
    If your FTP software does not work than absolutely.

    Whoa! Maybe instead of insulting people with knowledge you could tell us why exactly you had a bunch of clients leave your system?
     
  5. JohnFarrell

    JohnFarrell VIP

    Joined:
    Apr 13, 2011
    Messages:
    828
    Likes Received:
    35
    Trophy Points:
    0
    SG, VoloMP, Robo, etc all have a vested interest in keeping their customer base ignorant. It's how they all make money (off of ignorant people). They like to perpetuate the myth that it's 100% about the data and there's no need to know anything else!!! When in fact that's an out right lie, but they'll never admit it.

    Yes, I do realize that not everyone that uses one of the above systems is ignorant about stuff a mailer should know. So, don't get your panties in a bunch and take it personal (unless you don't even know how SMTP work then go read the RFC).
     
  6. mx10

    mx10 VIP

    Joined:
    Mar 30, 2011
    Messages:
    535
    Likes Received:
    18
    Trophy Points:
    18
    when you have a file you want to ftp from point a to point b, there is nothing stopping you, you don't need to know anything at all to get the file where you want it other than clicking the upload button, the file goes exactly where you want it to and is the same size and checksum as it is on your local hard drive.


    when you have a 1 million record list you want to deliver, and an isp is putting it in the bulk folder and only accepting 10,000 emails per hour, it's can be incredibly important to understand the inner workings of an MTA and smtp transactions in general. :22:
     
  7. DKPMO

    DKPMO VIP

    Joined:
    Mar 31, 2011
    Messages:
    1,452
    Likes Received:
    68
    Trophy Points:
    48
    Location:
    Elaborate Underground Base
    I am not getting my panties in a bunch. I am genuinely curious about the competitive dynamics between ESPs.

    SG, could you post us a post-mortem on your mass client defection: 1) What really happened 2) What have you changed 3) How it has been working out so far?

    P.S. I do not think every mailer absolutely has to know any of technical stuff whatsoever.
     
  8. JohnFarrell

    JohnFarrell VIP

    Joined:
    Apr 13, 2011
    Messages:
    828
    Likes Received:
    35
    Trophy Points:
    0

    That wasn't directed at you. It was directed at people who don't understand the SMTP protocol.

    I think mailers should know technical stuff for their own benefit. The less people you depend on the better. The reason I preach that is for self reliance not to be a prick.

    I'm not embarrassed to say I've gone broke before. Shit happens and people learn lessons, but if I didn't have the tech knowledge I have it would have been a real pain in the ass to recover. I've known mailers that went bust and didn't have the tech knowledge and they ended up actually scamming sysadmins / programmers to get back on their feet. I'm not saying everyone would do that (I'd hope they wouldn't), but without some sort of drastic measure you're pretty much fucked.
     
    Last edited: Aug 20, 2011
  9. DKPMO

    DKPMO VIP

    Joined:
    Mar 31, 2011
    Messages:
    1,452
    Likes Received:
    68
    Trophy Points:
    48
    Location:
    Elaborate Underground Base
    You posted about this yourself less than two weeks ago: http://www.mailerforum.com/forum/showthread.php?t=1445

    Perhaps you could elaborate what has transpired here.

     
  10. DKPMO

    DKPMO VIP

    Joined:
    Mar 31, 2011
    Messages:
    1,452
    Likes Received:
    68
    Trophy Points:
    48
    Location:
    Elaborate Underground Base
    Because that was my point.

    Not every ESP is right for everyone and that's why people build their own systems.

    But I am happy for everyone who is happy with SG.
     

Share This Page