Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

SMTP and Delivery of Email (Non Troubleshooting)

  • 07-07-2009 3:21pm
    #1
    Moderators, Education Moderators, Technology & Internet Moderators, Regional South East Moderators Posts: 24,056 Mod ✭✭✭✭


    Quick question to any of those who can remember the theory behind SMTP.

    My understanding of the SMTP commands required to send an email to boss@company.com, admin@company.com and CC to auditor@accountants.com seems to be;
    S: 220 company.com
    C: HELO company.com
    S: 250 HELLO company.com, I am glad to meet you
    C: MAIL FROM: boss@company.com
    S: 250 Ok
    C: RCPT TO: <admin@company.com>
    S: 250 Ok
    C: RCTP TO: <auditor@accountants.com> 
    S: 250 Ok
    C: DATA
    S: 354 End data with <CR><LF>.<CR><LF>
    C: From
    C: To
    C: CC
    C: Data
    C: Subject
    C:  
    C: The annual company financial review will take place during the first
    C: Week of December.
    C: Regards,
    C: Boss
    C: .
    250 Okay:  Queued as 12345
    C: QUIT
    S: 221 Bye
    

    Now, I think I am 99% right but the sending of an email outside the domain has me thinking I am missing something. Would appreciate someone point out what I am missing, as I am not sure how the process works with CC/BCC.


Comments

  • Registered Users, Registered Users 2 Posts: 2,426 ✭✭✭ressem


    You've got 2 data's in there.
    For the BCC, you add a "rcpt to:" for that address, but don't add a corresponding line in the DATA section. If you do put in a BCC: in the data section, then the server should remove it.
    Eg. I bcc the message back to boss. below

    For the To and CC, add in the CCs that you want to appear in the client seperated by a comma and space.

    S: 220 company.com
    C: HELO company.com
    S: 250 HELLO company.com, I am glad to meet you
    C: MAIL FROM: boss@company.com
    S: 250 Ok
    C: RCPT TO: <admin@company.com>
    S: 250 Ok
    C: RCPT TO: <auditor@accountants.com>
    S: 250 Ok
    C: RCPT TO: <friend@accountants.com>
    S: 250 Ok
    C: RCPT TO: boss@company.com
    S: 250 Ok
    C: DATA
    S: 354 End data with <CR><LF>.<CR><LF>
    C: From: boss@company.com
    C: To: admin@company.com
    C: CC: auditor@accountants.com, friend@accountants.com
    C: Subject: annual company financial review
    C:
    C: The annual company financial review will take place during the first
    C: Week of December.
    C: Regards,
    C: Boss
    C: .


  • Registered Users, Registered Users 2 Posts: 68,317 ✭✭✭✭seamus


    I think Ressem has it there.

    The client interprets the To and CC from the header of the DATA, and not from any other means. BCCs are inserted as RCPT TO commands, but they are not inserted into the header of the mail. So only the SMTP server knows who has been BCCed on a mail - the receiving POP server is not told all of the recipients of the mail, it's only told what specific mailbox to deliver the mail to. The header of this mail will contain the CC recipients and the client then interprets that.


  • Registered Users, Registered Users 2 Posts: 2,426 ✭✭✭ressem


    Nearly had it...
    According to the rfc2822, if you do add a BCC: field in the header then servers are only required to hide addresses from those addresses who were in the TO and CC.
    Exchange seems to work this way.
    Edit:No it doesn't. It adds a BCC line, containing just that BCCed recipients address.

    If you leave out them all, then Exchange will add a blank BCC: field.

    The Wireshark network sniffer together with thunderbird with unencrypted SMTP outgoing account are handy for debugging this sort of stuff.


  • Moderators, Education Moderators, Technology & Internet Moderators, Regional South East Moderators Posts: 24,056 Mod ✭✭✭✭Sully


    ressem wrote: »
    You've got 2 data's in there.
    For the BCC, you add a "rcpt to:" for that address, but don't add a corresponding line in the DATA section. If you do put in a BCC: in the data section, then the server should remove it.
    Eg. I bcc the message back to boss. below

    For the To and CC, add in the CCs that you want to appear in the client seperated by a comma and space.

    S: 220 company.com
    C: HELO company.com
    S: 250 HELLO company.com, I am glad to meet you
    C: MAIL FROM: boss@company.com
    S: 250 Ok
    C: RCPT TO: <admin@company.com>
    S: 250 Ok
    C: RCPT TO: <auditor@accountants.com>
    S: 250 Ok
    C: RCPT TO: <friend@accountants.com>
    S: 250 Ok
    C: RCPT TO: boss@company.com
    S: 250 Ok
    C: DATA
    S: 354 End data with <CR><LF>.<CR><LF>
    C: From: boss@company.com
    C: To: admin@company.com
    C: CC: auditor@accountants.com, friend@accountants.com
    C: Subject: annual company financial review
    C:
    C: The annual company financial review will take place during the first
    C: Week of December.
    C: Regards,
    C: Boss
    C: .

    The connection seems to open with company.com and the accountants.com email seems to be treated, from looking at the above, as being local? Surely another connection is needed for that mailbox outside of the company.com domain?


  • Registered Users, Registered Users 2 Posts: 2,426 ✭✭✭ressem


    Since it's Boss@company.com sending to a company.com server,
    then I'm assuming that Boss has permission to relay through the company.com server, because he is using an internal IP or has authenticated in some manner.

    In which case the mailserver at company.com will do the work of relaying on to the other servers.

    Provided that your mail server is configured to allow you to relay the mail forward, the mail addressed to admin@accountants.com and auditor@accountants.com will be added to a queue which will open an individual SMTP connection for each domain in the "rcpt to:" section.

    So sending one mail to your SMTP server can result in it opening hundreds of connections to other servers.


  • Advertisement
  • Moderators, Education Moderators, Technology & Internet Moderators, Regional South East Moderators Posts: 24,056 Mod ✭✭✭✭Sully


    ressem wrote: »
    Since it's Boss@company.com sending to a company.com server,
    then I'm assuming that Boss has permission to relay through the company.com server, because he is using an internal IP or has authenticated in some manner.

    In which case the mailserver at company.com will do the work of relaying on to the other servers.

    Provided that your mail server is configured to allow you to relay the mail forward, the mail addressed to admin@accountants.com and auditor@accountants.com will be added to a queue which will open an individual SMTP connection for each domain in the "rcpt to:" section.

    So sending one mail to your SMTP server can result in it opening hundreds of connections to other servers.

    Thanks. I assume that the SMTP commands earlier in this topic would be the same for an email client sending mail by a local SMTP email server? Is it the same regardless?


  • Registered Users, Registered Users 2 Posts: 2,426 ✭✭✭ressem


    Simple answer yes.

    Long winded version, depending on what you mean by a local SMTP Server.
    If it's a SMTP server running on your own desktop, it might be blocked by a Company/ College / ISP from relaying out onto the internet by a firewall. But in that case your client would also be blocked from talking directly to external SMTP servers.

    If it's an official SMTP server for your local network then yes you should be able to relay out. If not you might get a different response when you provide a recipient. Something along the lines of...
    C: RCPT TO: <friend@accountants.com>
    S: 550 Not permitted to relay through this computer.


  • Moderators, Education Moderators, Technology & Internet Moderators, Regional South East Moderators Posts: 24,056 Mod ✭✭✭✭Sully


    ressem wrote: »
    Simple answer yes.

    Long winded version, depending on what you mean by a local SMTP Server.
    If it's a SMTP server running on your own desktop, it might be blocked by a Company/ College / ISP from relaying out onto the internet by a firewall. But in that case your client would also be blocked from talking directly to external SMTP servers.

    If it's an official SMTP server for your local network then yes you should be able to relay out. If not you might get a different response when you provide a recipient. Something along the lines of...
    C: RCPT TO: <friend@accountants.com>
    S: 550 Not permitted to relay through this computer.

    What interests me is these type of questions were on a Leaving Cert paper I came across (some schools did Computers in LC). I was a tad confused as the contents of my first post was a question (ie create the sequence of commands) but the next part was very similar and asked to "Describe the process by which SMTP email is transferred from an email client to its destination by a local SMTP email server".

    It seems to be a very basic question going on about email client connecting to server, sever doing part a, dns look up etc. What I found unusual was the reference to "local SMTP" - the process, I thought, would be the same regardless if I used my own servers or Eircoms.

    Interesting going back over these IT questions, not something I have ever had to put into practise yet.


  • Registered Users, Registered Users 2 Posts: 2,426 ✭✭✭ressem


    In those exam cases, the difference between the sending to a remote server (eircom) and local server (your company) would be an assumption that you could leave out authentication steps for the local server.

    Otherwise, you might need to talk about all the various branches.
    Authentication (Auth login\ntlm, prior pop3 etc).
    Server verifying these details, LDAP/ AD, linux PAM or whatever.

    and a load of things that a precocious kid might be distracted by, and an examiner would not have a clue about.


  • Moderators, Education Moderators, Technology & Internet Moderators, Regional South East Moderators Posts: 24,056 Mod ✭✭✭✭Sully


    Seems like a weird question - but I guess it shows understanding of how sending/receiving an email actually works and just dropping the factor of logging in (since that goes into a different ballgame and as you said, would confuse most correcting the paper).

    The LC exam papers were actually decent for those going into a degree/cert/course in IT. Just didnt cover much math (only binary)


  • Advertisement
  • Moderators, Education Moderators, Technology & Internet Moderators, Regional South East Moderators Posts: 24,056 Mod ✭✭✭✭Sully


    Actually, on the topic of SMTP - an "SMTP Request Message" (under the heading of MIME for attachments such as videos). I spotted a passing reference to it in some notes (related to the LC exam question), but cant get anything concrete on the net. I initally assumed it was in relation to message headers showing the MIME type for the email, but the reference to the SMTP has me wondering is it something else. Googled it, nothing concrete came up. I have no diagram or any other mention of it.


  • Registered Users, Registered Users 2 Posts: 2,426 ✭✭✭ressem


    Well along those lines you have ETRN, which requests a server to forward mail now, for dial up connections,
    or BDAT which is used instead of DATA to deliver the message in chunks, and notifies the destination as to the size of the message in advance for performance reasons.


Advertisement