Email or electronic mail is one of the greatest inventions of the 20th century. In 1972 Ray Tomlinson is credited with inventing the solution. 40+ years later email is still the backbone of modern communications. How does it work? This article explores a simplified technical build up of email and an introduction to how it works.
- Communications basics
- Protocols
- The complex world of email
[read more=”Read more” less=”Read less”]
Communications basics
Binary
In computers everything builds on everything else.
Everything starts with binary. On or off. Like a light switch, the light is on or off. In our minds we assign a number to the lights.
Very simply we imagine two lights side by side. Each light has a value.
- The light on the right has a value of 1.
- The left light has a value of 2.
Turning different combinations of lights on allows you to count from 0 to 3.
In computers we don’t need the actual bulbs but the concept of the switch on or off is there. Each switch is called a bit or binary digit.
Only counting to 3 isn’t much use as we want bigger numbers, so a group of 8 bits are a byte and one byte can count up to 255, for a total of 256 numbers including 0.
We just turn the switches on and off and suddenly we can have big numbers.
Morse Code
In 1836 Samuel Morse, along with Josephy Henry and Alfred Vail decided that sending electrical signals to send a message was a good idea. https://en.wikipedia.org/wiki/Morse_code
They put the idea of short dot or long dash could be combined to represent letters.
The most famous of these being dot dot dot dash dash dash dot dot dot meaning S (3 dots) O (3 dashes) S (3 dots). SOS or Save Our Souls meaning “Help!” SOS is shorter to write than HELP.
So if simple concepts in combinations build to make complicated things, this can be applied to computers.
Over a long distance, with on or off, dot or dash, you can send messages great distances.
Timing
In order for things to be considered short, it needs time. Imagine in a second.
- If the light is on for half a second, it’s a dot.
- Whereas if it’s on for a full second, it’s a dash.
Now you can do more code using light or using electrical signals in a cable.
In computers to make things simpler, what if you just had time and instead of short and long, you make it even simpler.
In eight seconds there is either a signal or no signal which therefore gives s binary, on or off and it can be communicated over great distance.
ASCII
The basics
What if each number represents a letter. This gave rise to ASCII or the American Standard Code for Information Interchange.
The capital letter A is the number 65 whereas the lower case a is the letter 97. There are a host of other assigned characters.
As the title implies this was American. As the Internet has grown and more and more languages are included the system ran out of numbers.
Internationally the newer version is called Unicode. https://en.wikipedia.org/wiki/Unicode
Unicode uses a lot more numbers to represent a lot more characters.
The problem is that bigger numbers take longer to transmit and if you’re not using all the numbers then it’s wasteful. So computer designers need to decide which is the best system to use for space and speed. So for this reason ASCII is still very common in solutions.
Historically inherited
One of the more historically fun ones to know is CR (13) and LF (10). On an original typewriter there is an ink cartridge which moves.
So for a new line you need to return the cartridge to the start of the line.
Then you need to remember to move the paper up a line as well.
So on a simple keyboard, we press return, however the code may have to be two things. CRLF.
Protocols
What is a protocol?
So now that we can communicate messages from one place to another and we have a system of representing letters and instructions we begin to allow devices to chat.
Imagine this conversation
- Hello
- Hello
- Can we speak English?
- Sure. What to you want to say?
- Is Philip home?
- No.
- Thanks. Goodbye.
This is a protocol. It starts with making sure you can communicate resulting in the two agreeing a language to use. The actual important bit comes next, the actual message. To make sure there is no more work to there is a closing.
It may seem a bit wasteful asking can we speak English however as we have seen above with different languages such as ASCII or Unicode, this step is important or the message could be misinterpreted.
The TCP/IP stack
When a computer sets a clock going for timing and then flicks on and off this is a very basic action.
Timing and signal verification programming is very complicated for developers to program. It requires in-depth knowledge of the area and technical understanding of what is happening. To save time computers have this down to a fine art and they reuse tried and tested computer programming.
Internationally agreed standards for communication are available to all equipment manufacturers. Ways for devices from different manufacturers to make sure their equipment will work together around the globe. For this reason the International Standards Organisation (ISO) provide a global model for computers to chat called the Open Systems Interconnectivity (OSI) model.
So the physical and datalink layer, look after getting the light on, light off bytes from one device to another. The most famous of these protocols at this level is called Ethernet.
When you get to the network layer every machine has a unique phone number. In computers this phone number is called an IP (Internet Protocol) number. It has the layout of four bytes, so is look like 121.232.141.9 Imagine a phone in a house. You have a unique phone number for the house. Every device connected to the Internet has a unique number.
Now because there may be many different people in the same house, you need different extensions in the house. In the Transport Layer, the Transmission Control Protocol (TCP) has port numbers which are extensions within the house.
The most famous port is port 80 which is used for web pages. Sending emails is port 25. Over time more and more ports have uses and only a small amount are standard internationally.
Message in a bottle
To truly experience how fast and amazing this all works so seamlessly try the following for yourself. Ping is a different protocol to email which simply says “Hello”. It is used to check if a server is a responding and how quickly it responds.
- Open a command prompt window
- Type ping 8.8.8.8
This is Googles DNS server located in Kansas https://whatismyipaddress.com/ip/8.8.8.8
The Irish Government website gov.ie is on 178.79.175.148 which is on a server just outside London https://www.lookip.net/ip/178.79.175.148
The Australian Broadcasting Corporation is on 23.203.249.65 which is on a server in Holland https://whatismyipaddress.com/ip/23.203.249.65
Yet the New Zealand Government website is on 103.28.251.187 which is in Aukland https://whatismyipaddress.com/ip/103.28.251.187
So in this example it takes me 234 milliseconds to get a message to New Zealand and 20 miliseconds to get a message to America.
This is why for communication email is far faster than traditional post and it’s free.
Sending email
When sending email you use the SMTP (Simple Mail Transfer Protocol) on port 25. You need a server to do the sending for you, like a post office. However your chat with the server will look something like this. These are your commands (the capital letters). The system uses ASCII.
- HELO yourserver.com
- MAIL FROM: philiplacey1@gmail.com
- RCPT TO: philip.lacey@bxpsoftware.com
- DATA
Date: Fri, 20 Jul 18 nn:nn:nn GMT
From: Philip <philiplacey1@gmail.com>
To: philip.lacey@bxpsoftware.com
Cc: someone.else@bxpsoftware.com
Subject: Hello
This is a demo email
. - QUIT
It is possible to use a DOS command prompt to send emails by hand using Telnet yourself. Just search google for one https://www.google.com/search?q=telnet+dos+smtp+example
It is possible to encrypt your connection to your email server using port 465 instead of the unencrypted port 25. However when your email goes from your mail server it will most likely not use encryption and just use port 25 for sending internationally.
Receiving email
When you receive email there are two protocols. The version 3 solution called POP3 (Post Office Protocol 3) or the more recent version 4, IMAP4 (Internet Message Access Protocol 4).
The more popular email programs in business are Microsoft Outlook which can let you use either protocol.
Popular Web Email or Webmail clients let you view your email inbox using a website. The website will probably use IMAP4 on your behalf. GMAIL is a good example of a webmail.
When you log into your online banking you will want your details secure between you and the bank. Websites use https (hyper text transfer protocol secure) to add encryption to the communication. POP3 and IMAP4 have secure versions. POP3 uses port 110 but the encrypted version uses 995. IMAP4 uses port 143 with the encrypted version using 993
The complex world of email
Abuse and junk mail
In the same way companies can push letters and mail through your front door called junk mail, your email can also receive junk email called spam.
When you fake a traditional letter there is a postage cost to them. There is also usually laws in the country regarding junk mail. In Ireland it is possible to register not to receive junk mail under the Data Protection Act of 1988 http://www.citizensinformation.ie/en/consumer_affairs/telecommunications_and_postal_services/dealing_with_unsolicited_direct_marketing.html
As of May 2018, the GDPR or EU General Data Protection Regulation, attempts to put a similar system in place for junk emails. Companies cannot contact unless you explicitly want them to contact you. https://www.itgovernance.eu/blog/en/how-the-gdpr-will-affect-spam
As email is free and global it is far harder to stop spam. There are programs which can help reduce spam but it is not possible to get it perfect.
Malicious email
Email was expanded to carry not only messages but content such as documents, pictures, videos, etc. Unfortunately a lot of not very nice people put attachments that will damage your computer or give them control of your computer in the emails.
If you remember the start of the movie the Rock starring Nicolas Cage. Things in post can be very bad. This is a movie but not everything you get in the post is good. Email is exactly the same. Warning : the clip includes adult language and themes. https://www.youtube.com/watch?v=9eMXZa7ueEY
Spear Phsishing (pronounced Fishing) is an email technique where an authentic looking email, usually with details specific about your life is sent to you which has a link to a website. This link downloads malware onto your computer doing various bad things.
What about the good guys?
Well because companies rightly need to be paranoid about malicious mail it can often block good emails. So when companies are trying to construct marketing emails which people want to receive they must negotiate a host of challenges.
Over many years working with bxp and various companies who want to send legitimate marketing messages to willing recipients a a library of tools and capabilities can be built into marketing tools to help you get your message where it needs to go with the minimum of disruption. There is a bxp wixi full article on improving delivery rates.
[/read]