www.linode.com
Open in
urlscan Pro
2606:4700::6812:8c12
Public Scan
Submitted URL: https://www.linode.com/docs/email/running-a-mail-server/#spf-records
Effective URL: https://www.linode.com/docs/guides/running-a-mail-server/
Submission: On November 12 via api from HU — Scanned from DE
Effective URL: https://www.linode.com/docs/guides/running-a-mail-server/
Submission: On November 12 via api from HU — Scanned from DE
Form analysis
3 forms found in the DOMGET https://www.linode.com/
<form role="search" method="get" action="https://www.linode.com/" class="c-search"><label for="s">Search</label>
<input type="search" placeholder="Search Linode" name="s">
<input type="submit" value="Search">
</form>
https://login.linode.com/signup
<form action="https://login.linode.com/signup" data-turbo="false"><input type="hidden" name="promo" value="DOCS32SAFC">
<button type="submit" target="_blank" class="bg-transparent hover:bg-gray-800 text-white text-md font-semibold py-2 px-4 border border-white hover:border-gray-800 rounded"> Sign Up</button>
</form>
POST https://delighted.com/t/iVc7nAYL?referrer=%2Fdocs%2Fguides%2Frunning-a-mail-server%2F
<form data-turbo="false" x-data="{}" :action="'https://delighted.com/t/iVc7nAYL?referrer=' + encodeURIComponent(window.location.pathname)" method="post" target="_blank" novalidate=""
action="https://delighted.com/t/iVc7nAYL?referrer=%2Fdocs%2Fguides%2Frunning-a-mail-server%2F">
<div class="flex flex-col items-center">
<h2 id="delighted">Your Feedback Is Important</h2>
<p class="text-base text-titlecolor md:text-lg mb-6 mt-2 text-center">Let us know if this guide made it easy to get the answer you needed.</p><button type="submit"
class="btn p-4 rounded-md border-2 border-gray-400 hover:border-brand hover:text-brand text-sm sm:text-lg" value="Feedback" name="feedback"> Provide Feedback</button>
</div>
</form>
Text Content
Free Cloud Migration Limited Time Free Migration Service * Search * Partners * Docs * Support * Sales * Careers * Log In English * English * Español * Why Linode * Products * Solutions * Marketplace * Pricing * Community * Sign Up * Mobile * Why Linode * Products * Solutions * Marketplace * Pricing List * Community * About Us * Docs * Partners * Support * Careers * Contact Sales * Log In * Press Center * Legal Center Sign Up Search FEATURED Cloud Spectator Benchmark Report Cloud Block Storage Access Report WHY LINODE * Choosing Linode * Support Experience * Predictable Pricing * Cloud Simplified * Free Bundled Services * Global Infrastructure GET TO KNOW US BETTER * About Linode * Customer Stories * Linode for Business * Alternative Cloud * Linode vs. Competitors * Open Cloud * What is Cloud Computing? FEATURED Free Bundled Services Discover our no-cost security, networking, maintenance, and monitoring solutions. Learn More View All Products COMPUTE * Dedicated CPU * Shared CPU * High Memory * GPU * Bare Metal * Kubernetes STORAGE * Block Storage * Object Storage * Backups SERVICES * Managed * Professional Services NETWORKING * Cloud Firewall * DDoS Protection * DNS Manager * NodeBalancers * VLAN DEVELOPER TOOLS * Cloud Manager * Linode API * CLI * Images * Integrations * StackScripts * Monitoring * Users & Permissions FEATURED Higher Ed: The University of Oklahoma Developing Innovative Approaches to Understanding Social and Natural Risks Read OU Story View All Solutions SOLUTIONS * Digital Agencies * eLearning * Higher Education * Machine Learning * Managed Hosting * Multicloud * SaaS * Video Streaming * Website Hosting FEATURED Total Cost of Ownership Calculator Migrating from on-premises or between cloud providers for hosting, cloud storage, or cloud computing? Launch Calculator PRICING * Pricing List * Cloud Estimator * TCO Calculator FEATURED Cloud CPU Benchmarks Benchmarking and analysis from Cloud Spectator includes Linode, AWS, Azure, Google Compute Engine, Alibaba, and DigitalOcean. Download COMMUNITY * Overview * Q&A * Developer Portal * Blog * Beta Program ENGAGE WITH US * Content Resources * Events * Newsletter * Press Center * Affiliate Program * Customer Referral Program * Startup Program * Swag Store Explore docs 1. Docs Home 2. Guides 3. Email Server Guides 4. Best Practices for Email Servers 5. * Contents SPF Records CONTENTS 1. Should You Run a Mail Server? 1. Sending Email on Linode 2. Benefits 3. Drawbacks 4. External Mail Services 2. How Mail Servers Work 1. The Mail Server Process 3. How to Choose Mail Server Components 1. Mail Transfer Agents 2. Mail Delivery Agents 3. IMAP and POP3 Servers 4. Build Your Mail Server 1. SSL Certificate 2. Software Installation 3. DNS Records 4. Time to Live (TTL) 5. MX Records 6. SPF Records 7. Reverse DNS 5. Spam and Virus Protection, Mail Clients, and More 1. Configure Spam and Virus Protection 2. What to do if your server has been blacklisted 3. Mail Clients 4. Webmail 6. Your Feedback Is Important Filtered by search term * Products 169 * Guides 1589 * Applications 188 * Database Management Systems 140 * Development 203 * Email Server Guides 63 * Best Practices for Email Servers 2 * Installing Mail Filtering for Ubuntu 12.04 * Running a Mail Server * Citadel 7 * Email Clients 6 * Email Services 3 * Exim Guides 7 * Mail-in-a-box 1 * Mailman Guides 6 * Postfix 24 * Zimbra Groupware 6 * iRedMail 1 * Game Servers 25 * IPs, Networking & Domains 71 * Kubernetes 60 * Linode Platform 161 * Quick Answers 55 * Security, Upgrades & Backups 118 * Tools & Reference 82 * Troubleshooting 9 * Uptime & Analytics 57 * Web Server Guides 202 * Website Guides 155 * API 291 * Marketplace 66 * Blog 441 * Resources 202 * Q&A 12000 1. Docs Home 2. List Sections Tiles SEARCH RESULTS results matching results NO RESULTS Previous Next FILTERS Filters ( ) All Add tags All 1. Docs Home 2. Guides 3. Email Server Guides 4. Best Practices for Email Servers 5. RUNNING A MAIL SERVER Updated Thursday, September 23, 2021, by Linode * Report an Issue * View File * Edit File * Share on Twitter * Share on Facebook * Share on Hacker News > Traducciones al Español > Estamos traduciendo nuestros guías y tutoriales al Español. Es posible que > usted esté viendo una traducción generada automáticamente. Estamos trabajando > con traductores profesionales para verificar las traducciones de nuestro sitio > web. Este proyecto es un trabajo en curso. Create a Linode account to try this guide with a $100 credit. This credit will be applied to any valid services used during your first 60 days. Sign Up This guide offers an overview of installing a mail server on your Linode. It covers mail server configuration, creating mail accounts, and basic overviews of tools relevant to hosting an email webserver. SHOULD YOU RUN A MAIL SERVER? If you do, you’ll have control over your domain’s email, but you’ll also have to deal with the hassles associated with setting up a complex environment of software. Using a third-party mail service is easier, but you’ll sacrifice control and flexibility. In this section, we consider the benefits and drawbacks to running your own mail server, as well as how to choose an external mail service, if you decide to go that route. SENDING EMAIL ON LINODE In an effort to fight spam, Linode restricts outbound connections on ports 25, 465, and 587 on all Linodes for new accounts created after November 5th, 2019. If you have a need to send mail from your Linode, we ask that you first configure (1) valid DNS A records and (2) rDNS records for any Linodes that you plan to use to send mail. Then, open a Support ticket from the Linode Manager – we’ll ask you to provide the name of the Linode(s) that will be used for mailing. Once you’ve completed those steps and provided that information, our Support team will be happy to review your request. > Note > If using multiple domains to send mail from a single Linode, rDNS will only > need to be configured for one of the domains actively sending mail. BENEFITS If you want or need full control of your email, running your own mail server might be ideal solution. Doing so allows you to store your own email, access the mail server’s logs, and access the raw email files in a user’s mailbox. Some benefits of running a mail server are: * Full control over both the server and your email * Pick the applications you want to use, and tune them for your needs * View logs for incoming and outgoing messages * View logs for connection and authorization attempts from local mail clients for IMAP, POP3, and SMTP * Mail will cost no more than the price of your Linode DRAWBACKS Running your own mail server isn’t for the faint of heart. Setting up the software is tricky, filtering spam can be difficult, and keeping everything running smoothly is challenging. You should carefully consider all of your options before deciding to run a mail server. Here are a couple of the drawbacks: * Configuration is complicated * Downtime can result in lost email * Spam and virus filtering need to be tuned just right to block unwanted emails and allow legitimate ones * If a spammer discovers an exploit, they could use your Linode to send spam, and your IP address could be black-listed * No third party support to troubleshoot e-mail issues. You’re responsible for everything related to your Linode. Maintaining, upgrading, and troubleshooting the mail server is your responsibility. Visit Linode’s Terms of Service for more information about acceptable use. EXTERNAL MAIL SERVICES If the prospect of managing your own mail server is too daunting, you should consider using a third-party mail service. For a fee, these services provide managed mail servers and take care of all hosting, maintenance, and troubleshooting tasks. You won’t have as much control if something goes wrong, but you also won’t need to worry about the pitfalls of running a mail server. There are several third-party mail services available: * Postmark * Fastmail * Google Workspace uses the familiar Gmail interface. Check out our guide to Using Google Workspace for Email. * Office 365 is the successor to Outlook.com and can support custom domains for email, amongst other services. If you decide to use an outside mail service, you will still need to set up DNS for your mail and use the settings provided by the third-party mail service. HOW MAIL SERVERS WORK Every mail server that lets you send and receive email with a local mail client has three separate software components: * MTA: The Mail Transfer Agent relays mail between your Linode and the wider Internet, whether it’s delivering an outside email to one of your users, or sending an email from one of your users. Accepted incoming mail gets added to the MTA’s queue on the server. * MDA: The Mail Delivery Agent takes mail from the MTA’s queue and saves it to individual mailboxes on your Linode. * IMAP/POP3 Server: Manages users and their mailboxes as they check their email over IMAP/POP3 connections. THE MAIL SERVER PROCESS 1. An incoming message is directed to your Linode via DNS. 2. Once it passes through the MTA and MDA, it is stored in the user’s mailbox on the server. 3. When the message is requested, the IMAP/POP3 server mediates the connection between your Linode and the user’s local mail client. 4. Outgoing mail is sent from the user’s local mail client, processed by your Linode’s MTA, and is then sent to its destination on the Internet. HOW TO CHOOSE MAIL SERVER COMPONENTS There are several software packages that can be used as MTAs, MDAs, and IMAP/POP3 servers, and this section will present some of the most popular options. The examples in the later sections of this guide use Postfix as the MTA and Dovecot as the MDA and IMAP/POP3 server. MAIL TRANSFER AGENTS MTAs are responsible for handling SMTP connections to your Linode from both outside senders and your own users. When your Linode is asked to relay an email, it decides what to do with the email based on the rules you give it. The MTA delivers the message locally if it is sent to a user you host on your Linode, relays it to another server if it was sent from one of your authorized users, and rejects it if it’s neither to nor from a user on your Linode. Here are the most popular MTA services available: * Courier Mail Server comes with Courier-IMAP, which is the popular part of the Courier mail server suite, but Courier-MTA also includes mail relaying features. It’s a simpler MTA but somewhat limited. * Exim is modern and oriented towards flexibility. It’s secure, but not quite as security-oriented as Postfix. It’s very customizable, but is one of the most complex MTAs to configure. * Postfix is part of Linode’s recommended mail server build. It’s modern, security-oriented, and very flexible. It is slightly simpler to set up than Exim. * Qmail is a modern MTAs and supports Maildir-style directories. Qmail has not received an update since 2007, but remains very popular. * Sendmail is a legacy MTA that has a large following and good support. * Zimbra is an all-in-one mail service. Zimbra offers a simple install, but few configurable options. MAIL DELIVERY AGENTS MDAs move email from the MTA’s queue to individual mailbox directories within your Linode, for example: your mailbox could be located at /var/mail/example.com/user/. MDAs are also known as Local Delivery Agents (LDAs). Different MTAs support different types of mailboxes. The most common types are the older mbox mailboxes which store all the messages together in a single file, and Maildir mailboxes which store each email in a separate file and support multiple folders. MDAs are often bundled with other mail-related applications. These are some of the most popular MDAs available: * Cyrus’s MDA is part of the Cyrus IMAP/POP3 server. Cyrus is a modern, security-oriented IMAP/POP3 server designed to run on servers where users do not log in directly. * Deliver is a simple Linux mail delivery utility that is configured in the Imapd configuration files by default. * Dovecot’s LDA and Dovecot’s LMTP server are part of the Dovecot IMAP/POP3 server. Dovecot is a lightweight, modern, and configurable mail server. * maildrop is Courier’s MDA. Courier is an all-in-one mail server. * Postfix’s MDA is part of the Postfix MTA software. Postfix is a modern, security-oriented, flexible MTA. * Sendmail’s MDA is part of the Sendmail MTA software. Sendmail is an older MTA that is still popular. IMAP AND POP3 SERVERS An IMAP or POP3 server handles connections from incoming IMAP or POP3 clients like Microsoft Outlook and Apple Mail. The server manages client access to the mailboxes and raw mail files so that the email is displayed in a modern way. Most servers and clients support both IMAP and POP3. POP3 clients connect to the server at specified intervals and download all of a user’s messages without leaving copies on the server by default. POP3 was developed when most people used only one device to access one email account. IMAP is a newer protocol designed for multi-device users. IMAP clients stay continuously connected to the server and IMAP mailboxes mirror the mailboxes on your Linode. IMAP and POP3 both have secure versions (IMAPS and SSL-POP) which use SSL encryption for mail transfer. Always use the secure version whenever possible. Here are the most popular IMAP and POP3 servers available: * Citadel is an all-in-one mail service that includes mail, calendars, instant messaging, mailing lists, and other collaboration tools. It’s open source and geared towards small and medium-sized organizations. Linode has guides for Citadel on Ubuntu 12.04 and Citadel on Debian 6. * Courier has a very popular IMAP server called Courier IMAP. It’s an all-in-one mail server software suite, but Courier IMAP can be installed by itself if that’s the only part you need. * Cyrus is a modern, security-oriented IMAP/POP3 server designed to work on sealed servers where users do not log in directly. * DBMail is an open source project that stores mail in databases instead of flat files. * Dovecot is a lightweight, modern, and configurable mail server, and is part of our recommended mail server build. * Xmail is a full-featured POP3 server, but does not support IMAP. * Zimbra is an all-in-one mail service that’s much simpler to install than other options, but less customizable. BUILD YOUR MAIL SERVER SSL CERTIFICATE An SSL certificate encrypts connections to your mail server. It’s possible to run a mail server without an SSL certificate, but it’s not recommended. Any type of SSL certificate will work, but some certificates have different degrees of trustworthiness for your users. If you want the highest level of trustworthiness, you should purchase a signed SSL certificate from a reputable company. You can also use a free self-signed certificate if you are comfortable with the warnings it generates. You can make your own self-signed SSL certificate, or, if you’re following our recommended build, you can use the one that comes with Dovecot by default. SOFTWARE INSTALLATION Install and configure the MTA, MDA, and IMAP/POP3 server. To help manage domains, email addresses, user credentials, aliases, etc., install a database server like MySQL or PostgreSQL. For detailed configuration instructions, see our Postfix, Dovecot, and MySQL guide. For more mail server guides, including guides for older software versions and other mail-related services, visit our Email Server Guides. DNS RECORDS DNS records help email reach your Linode. The right DNS records also help designate your Linode as a legitimate mail server. In this section, you’ll learn how to set the appropriate MX, SPF, and PTR records for your domain and Linode. TIME TO LIVE (TTL) You should lower the Time to Live (TTL) on your existing DNS records to the lowest allowed value at least 24-48 hours before you make any other DNS changes. That way, any changes you make later will propagate quickly. It’s also a good idea to keep your old mail server running for at least 48 hours after you start directing mail to your Linode, just in case the DNS changes take a while to propagate. MX RECORDS MX records tell the Internet where to send your domain’s email. If someone sends an email to user@example.com, the outgoing server looks up the DNS settings for the domain example.com. When it finds the MX record pointing to your Linode, it sends the message to your Linode. Create an MX record for each domain and subdomain for which you want to receive mail on your Linode. You can also set multiple MX records with different priorities for the same domain. This creates fallback mail servers for your domain in case the first one on the list is down. Lower numbers have a higher priority. Your MX record has a: DomainTTLTypePriorityTargetexample.com86400MX10203.0.113.0 A typical MX record looks like this: example.com 86400 MX 10 example.com example.com 86400 MX 10 203.0.113.0 mail.example.com 86400 MX 10 203.0.113.0 If you use Linode’s DNS Manager, point your MX records to a target domain or subdomain that resolves to your Linode. Make sure that domain or subdomain has an A record that points to the correct IP address. SPF RECORDS SPF records help establish the legitimacy of your mail server and reduce the chances of spoofing, which occurs when someone fakes the headers of an email to make it look like it’s coming from your domain, even though it didn’t. Spammers may try to do this to get around spam filters. An SPF record for your domain tells other receiving mail servers which outgoing server(s) are valid sources of email, so they can reject spoofed email from your domain that has originated from unauthorized servers. In your SPF record, list all the mail servers from which you send mail, and exclude all the others. Your SPF record will have a domain or subdomain, TTL type which is plain text, or SPF if your name server supports it, and text which starts with v=spf1 and contains the SPF record settings. If your Linode is the only mail server you use, you should be able to use the example record below. With this SPF record, the receiving server will check the IP addresses of both the sending server and the IP address of example.com. If the IPs match, the check passes. If not, the check will “soft fail” (i.e., the message will be marked but will not automatically be rejected for failing the SPF check). example.com 86400 TXT "v=spf1 a ~all" Make sure your SPF records are not too strict. If you accidentally exclude a legitimate mail server, its messages could get marked as spam. Visit open-spf.org to learn how SPF records work and how to construct one that works for your setup. Their examples are also helpful. REVERSE DNS Set reverse DNS for your mail server’s domain or subdomain. The reverse DNS for your mail server must match the hostname of your Linode. If your Linode’s reverse DNS and hostname do not match, email from your server may get rejected with the warning “Reverse DNS does not match SMTP Banner.” If you need to check or set the hostname, see our Getting Started article. SPAM AND VIRUS PROTECTION, MAIL CLIENTS, AND MORE At this point, you should have a basic mail server up and running. There’s a bit more to do, however, if you want to provide your users with the best possible mail experience. This includes adding spam and virus filtering to protect your users, setting up mail clients, providing a webmail solution, and adding any extras you want, such as mailing lists. CONFIGURE SPAM AND VIRUS PROTECTION Spam that originates from your Linode may be a violation of Linode’s Terms of Service, and may lead to your server being blacklisted by a variety of organizations. Take steps to ensure that your Linode is not used as an open relay server, which would allow anyone to send messages anywhere using your server. To prevent your Linode from being used as an open relay, make a list of allowed domains and users for your MTA, and make sure it rejects everything else. There are also a few other scenarios where your server could be sending spam. If your server or an installed application are hacked, or if a user’s account is compromised, or if the emails you send are getting marked as spam by recipients. The best way to stay on top of outgoing spam is to keep an eye on your outgoing mail logs and pay attention to bounceback errors. Incoming spam can also be a problem. Spam filters help you deal with spam sent to your own users. They let you filter incoming messages based on origin, content, etc. Some spam contains viruses, which can cause more serious damage to recipients. Here are some of the most popular spam and virus filter services: * Amavis is an open source content filter for email that integrates directly with your MTA. It does some checking on its own, and can also be used in conjunction with more robust spam and virus filters. * Clam AntiVirus is a popular, free, and open-source virus scanner. * SpamAssassin is a very popular free spam filter. * Anti-Spam SMTP Proxy Server Anti-Spam SMTP Proxy Server implements multiple spam filters. WHAT TO DO IF YOUR SERVER HAS BEEN BLACKLISTED If your Linode is added to a block list, take steps to mitigate the source of the spam. Once mitigated, contact the mail provider that blocked you and follow their steps to be allowed to send mail again. MAIL CLIENTS Mail clients are an integral part of the email experience for your users. Microsoft Outlook, Apple Mail, and Mozilla Thunderbird are all examples of mail clients. Most mail clients are compatible with most mail servers – you just need to make a note of the settings you configured on the server side, and make sure you use compatible settings on the client side. Here are some clients to consider: * Protocols: Choose IMAP or POP3 for receiving, and SMTP for sending. * Encryption: Choose SSL and/or TLS encryption, based on your server settings. * Authentication: Make sure the format of the credentials entered in the mail client matches the format expected by the server. Sometimes just the “user” part of the email address is the username, and sometimes the entire email address, including the @ sign, is the username. You can also have usernames that are not related to their corresponding email addresses, but this is not recommended. * Mailbox format: Make sure your users will be able to read, create, and use all of the folders they need. * Ports: Not only do your mail client(s) and server have to work on the same ports, but your internet service provider has to allow them as well. Here are some of the typical mail ports: * 110: POP3 * 995: SSL-POP (encrypted) * 143: IMAP * 993: IMAPS (encrypted) * 25: SMTP (sometimes blocked by ISPs) * 587: SMTP (The preferred non-encrypted port for outgoing connections from mail clients. Use STARTTLS for encryption.) * 465: SMTP (should only be used for legacy support) If you’re using a firewall, be sure to edit the rules for your mail server’s ports. See Linode’s guide to configuring a firewall for more information. WEBMAIL Webmail is a type of mail client that can be installed on your server and accessed from a web browser. It allows your users to access their email from your website (example: http://example.com/mail) anywhere they have access to the internet. Running a web server is a prerequisite for running a webmail client, so follow the Hosting a Website guide if you want to run webmail on your Linode, in addition to installing a mail server. Here are some of the most popular webmail clients: * Mail-in-a-box is an all-in-one mail option that offers a hassle-free approach to setting up a mail server and webmail component. * Citadel is an all-in-one mail service that includes mail, calendars, instant messaging, mailing lists, and other collaboration tools. It’s open source and geared towards small and medium-sized organizations. * Horde Webmail is an open-source IMAP client paired with some additional functions like account management and calendars. * RoundCube is an IMAP client with modern functionality and a clean layout. * SquirrelMail is a solid option, but has an older user interface. * Zimbra is an all-in-one mail service that’s much simpler to install than other options, but less customizable. This page was originally published on Wednesday, June 5, 2013. email * Report an Issue * View File * Edit File * Share on Twitter * Share on Facebook * Share on Hacker News -------------------------------------------------------------------------------- YOUR FEEDBACK IS IMPORTANT Let us know if this guide made it easy to get the answer you needed. Provide Feedback -------------------------------------------------------------------------------- Join the conversation. Read other comments or post your own below. Comments must be respectful, constructive, and relevant to the topic of the guide. Do not post external links or advertisements. Before posting, consider if your comment would be better addressed by contacting our Support team or asking on our Community Site. Please enable JavaScript to view the <a href=http://disqus.com/?ref_noscript>comments powered by Disqus.</a>comments powered by Disqus © 2003-2021 Linode LLC. All rights reserved. FOLLOW US * Twitter * Instagram * YouTube * LinkedIn * GitHub WHY LINODE * Choosing Linode * Support Experience * Predictable Pricing * Cloud Simplified * Free Bundled Services * Global Infrastructure * Customer Stories * Linode for Business * Alternative Cloud * Linode vs. Competitors * Open Cloud * What is Cloud Computing? COMPANY * About * Leadership * Partners * Press Center * Careers * Legal * Cookie Preferences PRODUCTS * Products Overview * Dedicated CPU * Shared CPU * High Memory * GPU * Bare Metal * Kubernetes * Block Storage * Object Storage * Backups * Cloud Firewall * DDoS Protection * DNS Manager * NodeBalancers * VLAN * Managed * Professional Services * Cloud Manager * API * CLI SOLUTIONS * Solutions Overview * Digital Agency * eLearning * Higher Education * Machine Learning * Managed Hosting * Multicloud * SaaS * Video Streaming * Website Hosting MARKETPLACE * Browse Marketplace * Submit Marketplace App PRICING * Pricing List * Cloud Estimator * TCO Calculator COMMUNITY * Community Overview * Q&A * Developer Portal * Blog * Events * Content Resources * Affiliate Program * Beta Program * Customer Referral Program * Startup Program * Swag Store * Documentation * Distributions * Cloud Computing Terms CONTACT * Support * Contact Sales * System Status * Log in FOLLOW US * Twitter * Instagram * YouTube * LinkedIn * GitHub