
- by x32x01 ||
Your Complete Guide to Email and How to Keep It Safe 
What Is Email and How Does It Work?
Email is a fast and easy way to send messages over the internet. Instead of mailing a letter or postcard, you send a digital message that reaches the recipient in minutes - or even seconds! Every email has two main parts: the header, which contains control info and addresses, and the message body, which holds the content itself.Email servers typically use two main services:
- Incoming Mail Server: like POP3 or IMAP, which stores incoming emails.
- Outgoing Mail Server: SMTP, which sends emails to other servers.
Differences Between SMTP, POP3, and IMAP
- SMTP (Simple Mail Transfer Protocol): Sends emails from your client to the server or to another server. It usually works on port 25, but secure connections often use 587 or 465.
- POP3 (Post Office Protocol 3): Downloads emails to your device and often removes them from the server—good if you only check mail on one device. It runs on port 110 (unsecured) or 995 with SSL.
- IMAP (Internet Message Access Protocol): Syncs emails across multiple devices. Emails stay on the server, and you can access them from anywhere. Standard ports are 143 or 993 with SSL.
Email Headers & SMTP Example Code
Here’s a sample email header: Code:
From: ali@example.com
To: sara@example.net
Subject: Email Test
Date: Fri, 17 Oct 2025 12:00:00 +0300
Message-ID: <12345@example.com>
A simple SMTP session (CLI style):
Code:
220 mail.example.com ESMTP Postfix
HELO client.example.net
250 mail.example.com
MAIL FROM:<ali@example.com>
250 2.1.0 Ok
RCPT TO:<sara@example.net>
250 2.1.5 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
Subject: Test
Hi Sara!
.
250 2.0.0 Ok: queued as 12345
QUIT
221 2.0.0 Bye
Why Email Is Not Fully Secure by Default
Emails often travel as plain text, meaning anyone intercepting the message could read or even modify it. There are multiple “hops” between mail servers, and each is a potential weak spot if not properly secured.Best Practices to Keep Your Email Safe 
1. Use End-to-End Encryption (PGP / S/MIME)
When sending sensitive info, encrypt your email using PGP or S/MIME, so only the intended recipient can read it.2. Enable TLS/SSL Connections
Always make sure your email client connects securely to the server using TLS or SSL (ports like 465, 587, 993, or 995). This protects your email from being intercepted in transit.3. Use Strong Spam Filters
Activate spam filters to automatically block phishing and junk emails. Most email providers (Gmail, Outlook, etc.) include this, but businesses should consider advanced filtering tools.4. Don’t Open Attachments from Unknown Senders
Attachments can carry malware or viruses. Always:- Verify the sender before opening.
- Scan attachments with up-to-date antivirus software.
5. Avoid Sending Executable Files (.exe, .vbs)
If you need to send files, use safe formats like PDF, RTF, or plain text. Avoid Word docs with macros, which can spread viruses.6. Don’t Share Personal Info via Email
Never send passwords, credit card numbers, or other sensitive data over regular email. Use encrypted channels when necessary.7. Beware of Links in Emails
Phishing links can steal your info. Always:- Hover over links to check the URL.
- Make sure the sender’s domain matches the real company.
8. Secure Your Server (SPF, DKIM, DMARC)
For domain owners:- SPF: Specifies which servers can send emails on behalf of your domain.
- DKIM: Adds a digital signature to verify email integrity.
- DMARC: Tells servers how to handle messages that fail SPF/DKIM (reject or quarantine).
Implementing all three protects against spoofing and improves domain reputation.
Practical Tips for Regular Users
- Enable two-factor authentication (2FA) for extra security.
- Use strong, unique passwords and a password manager.
- Keep your email app updated.
- Backup important emails.
How to Handle Suspicious Emails Step by Step
- Don’t open attachments or links.
- Check the sender’s email address carefully.
- Avoid giving personal info.
- Contact the sender through official channels to confirm.
- Report phishing emails to your provider or IT team.
Coding Examples & Tools for Developers
Send secure emails using Python (smtplib): Python:
import smtplib, ssl
from email.message import EmailMessage
msg = EmailMessage()
msg.set_content("Hello from Python")
msg["Subject"] = "Test Email"
msg["From"] = "you@example.com"
msg["To"] = "friend@example.net"
context = ssl.create_default_context()
with smtplib.SMTP_SSL("smtp.example.com", 465, context=context) as server:
server.login("you@example.com", "yourpassword")
server.send_message(msg)
Other useful tools:
- OpenSSL to test TLS connections.
- DNS tools to check SPF, DKIM, and DMARC records.
Summary - Stay Smart and Protect Your Privacy
Email is powerful and fast, but without security precautions, it can be risky. Encrypt your messages, double-check links, enable 2FA, and scan attachments. Start with these two: turn on two-factor authentication and scan email attachments before opening - you’ll be much safer online! 
Last edited: