Installing and configuring a mail server. Setting up email programs on your computer. Setting up outgoing mail

Setting up your own mail server, as a rule, does not cause any particular difficulties. A large number of ready-made instructions are available on the Internet. Literally one command, and port 25 is already ready to go. It becomes fun when sent emails start returning, and recipients complain that the messages are not being delivered. Here, like it or not, you will have to look for reasons and delve into technology.

Who sends letters

Today, many web services offer the ability to link your domain to a service. Posting mail on Gmail or Yandex is especially popular. All messages will go through the SMTP server provided by them; a trusted service provider will generate all the necessary headers and signatures that will allow them to pass through any spam filter. But this option is not always possible. For example, an organization has a large number of users and needs special settings for mail that are not available in cloud services. Or you use your own server with a portal, CMS or online store from which you need to send messages.

By default, all PHP applications use the mail() function to send mail, which in turn sends them through the local SMTP server described in php.ini.

Sendmail_path = /usr/sbin/sendmail -t -i

Or in a virtual host:

Php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f [email protected]"

And although sendmail is written there in 100% of cases, in fact it can be a symlink, and the mail is sent by Postfix or Exim. To send mail from the application, you can choose one of three options:

  • The engine itself sometimes allows you to specify an external SMTP server (in the default settings or through a plugin, in WordPress this is WP Mail SMTP or Easy WP SMTP). You just need to provide your account details and all problems are solved.
  • Using a plugin program that emulates the operation of a local SMTP server and sends messages through a mail account on a third-party server. SSMTP is very popular here.
  • Using your own mail server. Of course, you will have to configure it, but there are more configuration options.

We are interested in the last option. Let's look at how to break through anti-spam technologies and ensure that a message is delivered to the recipient. We will not filter spam ourselves. This is the topic of another article. We will choose Postfix and Exim as a test SMTP server; they are popular on hosting sites and are simple and straightforward to configure, although the main issues will concern all SMTP servers.

How to avoid getting spam

Fighting spam is a headache for all mail administrators. Moreover, recently it is just relevant back side medals: spam filters are literally brutal. Therefore, there is practically no spam in incoming mail, but normal messages constantly disappear somewhere, clients and management get nervous, and we have to additionally make sure that the message has reached the addressee. And after installing the SMTP server, you will most likely have to tinker a little more to ensure that messages get anywhere at all. In particular, to evaluate the settings, you should see whether letters are delivered to the mailboxes of the main mail systems Gmail, Yandex, Mail.Ru. Usually at this stage the first difficulties appear, and all problems have to be solved personally.

Mail services use a multi-level spam filtering system, which is so serious and secret that even their own technical support does not know about the principles. And each service has its own priorities. Although usually some hint about the reason for non-delivery is contained in the service’s response letter. The mail-tester.com service also helps in analyzing the causes; just send a letter to the address indicated there and then, after analysis, receive the result and a list of problems. Some of them can be checked and resolved without setting up the SMTP server yet.

The fight against spam has spawned many technologies. The oldest of them is a blacklist, which contains all IPs and domains that are engaged in sending spam; open relays, proxies and Dialup addresses used for remote access can also be included here (that is, they theoretically should not send mail). Such blacklists are organized in different ways. DNSBL (DNS blacklist) are popular - blacklists in DNS format that are easy to query. There are many databases available today, not all of them are popular or used. The problem is that there is no list for a specific email service; how many and which ones they ask is a secret.

Domain names, like IP addresses, can be second-hand today. There is a possibility that a messaging service used them before you, or the host hosted on it was hacked and sent spam. Accordingly, they may well end up in one of the DNSBLs and be a problem. Mail.Ru rejected letters from one IP precisely because it was on one of these half-forgotten lists, having got there in 2010. Moreover, Mail.Ru did not even bother to check the correctness of SPF and DKIM. Things moved forward only when IP was removed from the blacklist.

You can check the IP or domain yourself by sending a DNS request to the selected DNSBL server using dig utilities:

$ host -tA site.ex.dnsbl..ex.dnsbl.org not found: 3(NXDOMAIN)

But it is more convenient to use online services that check several databases at once. The IP can be checked in dnsbl.info (59 bases) or whatismyipaddress.com (72 bases), the domain, in addition, in mxtoolbox.com (107 bases), spamhaus.org or multirbl.valli.org. If suddenly a domain or IP appears on the list, it is better to immediately write to support and remove your address.


Correct DNS

When a message is received, the remote SMTP server first analyzes the message header. The mail program only sends From, To, Date, Subject and X-Mailer. They are generally clear and simply indicate from whom and where to send. The rest of the header is generated by both the SMTP server and the application sending it. This, by the way, also needs to be taken into account, because letters sent via Telnet can be sent, but not with Roundcube, simply because they have a different header. Roundcube, for example, substitutes its HELO/EHLO based on the server_name or localhost variable if it is not defined. So sometimes you just need to set it explicitly:

$rcmail_config["smtp_helo_host"] = "example.org";

The same applies to self-written PHP scripts.

During transmission, the letter will pass through at least two SMTP servers, each of which also adds something of its own to the header. First of all, each server adds its Received: from. It is better to read them from bottom to top. The bottommost message is the sender's server, the topmost is the recipient's server. Although in reality there may be more servers, this is especially true when working with large service providers who, having accepted the letter, forward it further, or when using an SMTP proxy along the way. To analyze the message path, you can use a service from Google, which will show in an understandable form all SMTP servers, transit times and SPF, DKIM and DMARC tests (more on them later).


The Received headers are different, although there are general rules. A typical one looks like this:

Received: from server.example.org (helo=server.example.org) by st15.provider.com with esmtps (Exim 4.80.1) (envelope-from )

Here the message was received from a server called server.example.org, has IP 1.2.3.4, the same name was used in the helo greeting, Exim 4.80.1 of the server st15.provider.com received it. Message sent from [email protected]. Having accepted such a header, the SMTP server begins to check the data. Searches domain and IP in DNSBL databases. Checks the presence of an MX record for a domain. MX is initially used to find mail servers serving a given domain; its presence confirms that the domain is sending mail.

Next, it performs reverse name resolution by IP through a reverse DNS query using a PTR record. That is, he finds out which server name should be at the address from which the message came. This behavior was specified in RFC 2505 of February 1999, Anti-Spam Recommendations for SMTP MTAs. And although it has long been recognized that return zones are not a sufficient condition for unambiguously identifying the sender and often lead to errors and delays, they are still supported. Therefore, they must match, otherwise the message will at least receive a minus in the rating, and in the worst case, it will be discarded.

In our example, server.example.org should be assigned to IP 1.2.3.4. The DNS record looks like this:

1.2.3.4.in-addr.arpa. IN PTR server.example.org

For IPv6, ip6.arpa is used. In principle, it is not necessary to know about the features of PTR, since PTR, with rare exceptions, is configured only by the hosting provider. And if you are not satisfied with it, then you just need to contact support. You can check PTR using the request:

$ dig -x 1.2.3.4

In fact, the PTR record after VDS deployment can point to a technical domain provided by the provider, like srv01.provider.net, in the VDS template the hostname is entered as Ubuntu1604 (changes in /etc/hostname), in HELO/EHLO the SMTP server generally writes localhost .localdomain , and the letter comes from the example.org domain. The probability of delivering a letter under such conditions will rapidly approach zero. Although some services mark such inconsistencies as an error and conduct a full check.

I would especially like to point out that VDS usually has two IPv4 and v6. Therefore, everything that has been said applies to both versions, since a letter to one server can go over IPv4 and be delivered, while another prefers to use IPv6, and the letter may not reach the recipient. At the same time, many providers, providing IPv6, do not bother at all with setting up a PTR record, and checking it returns an error. But Google, for example, prefers IPv6 and immediately discards the letter if the PTR does not match the server name. In the service response message it looks like this:

Continuation is available only to members

Option 1. Join the “site” community to read all materials on the site

Membership in the community within the specified period will give you access to ALL Hacker materials, increase your personal cumulative discount and allow you to accumulate a professional Xakep Score rating!

The FossLook mail server is designed for creating “internal” user mailboxes (on your domain) and working with them - receiving/sending messages. The server also initiates receiving messages from other mail servers (mail.ru, gmail.com, etc.), as well as sending them messages if users registered on the server have external mailboxes. This article describes all the mail server settings

Creating and working with internal mail accounts is described. How to work with external mailboxes is described in the article.

To configure, launch the Administration Wizard and go to the "Network" page:

This start page mail server settings. Let's look at all the settings dialogs that are launched when you click the corresponding links on the start page:

Channels

Channels is the most important page. By filling it out, you will be able to create and work with “internal” mailboxes using your own Domain name.


Section "SMTP Settings"

  • Option Use– enables or disables the ability to exchange between the FossLook server and external mail servers.
  • Port– port number for exchanging messages via the SMTP protocol.
  • Certificate
  • SSL Port

Section "POP3 Settings"

  • Use– enables or disables the ability to exchange between the FossLook server and external email clients, except MS Outlook.
  • Port– port number for messaging via POP3 protocol.
  • Certificate– certificate information for encrypted exchange.
  • SSL Port– port number for encrypted communication.

Section "Routing"

  • Domain name– domain name of the machine on which the FossLook server is installed.
  • FQDN– fully qualified domain name of the machine on which the server is installed.
  • Network interface– IP address network card on the server through which the connection to the Internet occurs.
  • Do not take more than– maximum limit on the size of an incoming message.
  • Frame relay– domain name or IP address of the intermediate server to which all correspondence will be sent, and from which it will be sent further to recipients.

Section "Additional connection to the server"

  • Use– enables or disables an external channel for working with the server via the Internet.
  • Network interface– IP address of the network card that is involved in establishing a connection to the Internet.
  • Port– port number for connecting to the Internet.
  • Machine name– external domain name (obtained from the provider).

To work with internal mailboxes (within your network), just fill in the required fields in the POP3, SMTP and Routing settings sections. In order to send letters from internal mailboxes to external mailboxes (on servers on the Internet), you need to set up a channel to work with the server via the Internet.

General Internet Mail transport settings

Settings page for the Internet Mail transport module, which serves the mail server:

The purpose of the elements on this page is as follows:

  • Option Included– enable/disable the module (i.e. enable/disable the mail server).
  • Path to the service folder on the server– an alternative path for storing logs and other service files of the mail server. If empty, the default path is used.
  • Option Allow delegated sending of messages– this option is valid when the user has delegated the powers of another user or department, and he sends messages on behalf of another user (department). When this option is enabled, the recipient's message attributes indicate the real sender of the message in the "sender" column, and the user on whose behalf the message was sent in the "on behalf" column. If the checkbox is unchecked, only the user (department) on whose behalf the message was sent is indicated in both columns.
  • Logging type SMTP, POP3– type of protocol logging, you can choose: disable, logging to one file, logging to several files (each session is logged to a separate file), you can also enable adding message bodies to the logs.

The purpose of the elements on this page is as follows:

  • List of replacement addresses– lists of replacement recipients of messages of the form “address to which the letter is sent”; “address to which it arrives”.
  • List of exceptions local addresses – a list of local addresses from which you can send letters without authorization.
  • Outgoing connection timeout– connection timeout with other SMTP servers when sending mail.
  • Maximum number of messages per session– the maximum possible number of messages that the server can receive via SMTP at one time. Messages can be received both from mail clients and other mail servers.
  • Maximum message size, Megabyte– maximum allowed message size for sending/receiving on the server, MB.
  • Option Allow deleting messages via POP3– allows you to delete messages when collecting mail via POP3 from the mail server (by another client).
  • Interval for resending messages from the queue– specifies after what time (h:min:sec) the re-sending of a message from the queue will be initiated (if the previous attempt failed).
  • Number of resends of messages from the queue– determines the number of repeated sendings of messages from the queue (in case of unsuccessful previous sendings). If the message was not sent after the specified number of attempts, it ends up in the "Bad Messages" log.

The purpose of the elements on this page is as follows:

  • Error repetition period, minutes– if the error repeats within a specified time (in minutes), a notification is sent to the user.
  • Mail checking period– period of checking external accounts for new messages.
  • Option Receive only unread messages – enables receiving only unread messages from external servers.

Date:2010-10-12

HmailServer - free mail server for Windows

hMailServer- free mail server for Windows. Supports IMAP4, POP3, SMTP, virtual domains, anti-spam, anti-virus and much more. Integrated ClamWin, SpamAssassin.

1) Need to download latest version hmailServer from http://www.hmailserver.com/index.php?page=download and start installation

2) We agree to the license agreement

3) Specify where hMailServer will be installed

4) Choose necessary components for installation


5) Select the SQL location method and the database itself.

6) Select and enter a password

7) Enter the password and connect to the mail server control panel

8) The control panel of your hMailServer server itself

Plutonit.ru - Administration, Linux setup and Windows 2009 - 2018

Installing and configuring Mail Server

Installing and configuring a mail server

Installing and configuring a mail server E-mail is a service that allows you to exchange via computer network by electronic messages. Main Feature Email lies in the fact that information is sent to the recipient not directly, but through an intermediate link - electronic Mailbox, which is the location on the server where the message is stored until it is requested by the recipient. The mail server is computer program, designed to organize the exchange of e-mail between computers.

DIY mail server

Its main functions are receiving letters from clients and delivering them to recipients. Clients can be both users (using an email client program) and other mail servers. Users, using a mail client program (Outlook Express, Thunderbird, etc.), can create letters, send them to the server and retrieve mail from their mailboxes on the server. Communication between the server and the client occurs using special mail protocols - Simple Mail Transfer Protocol (SMTP) - when sending letters to the server and Post Office Protocol v.3 (POP3) - when receiving letters from the mailbox. Clients connect to the server through certain ports. For SMTP the standard port is 25, for POP3 it is port 110. There are various mail servers. As an example, let's look at installing and configuring the Courier mail server Mail Server. Courier Mail Server is a Windows mail server (email server) for local networks. It will help you quickly organize email exchanges in local network and on the Internet. Courier Mail Server does not require installation on the system. It is enough to download the archive with the program and unpack it to any folder on the hard drive of the computer that will work as a mail server. You can download the free version of Courier Mail Server 1.56 from the website http://courierms.narod.ru/. A more functional Courier Mail Server 2.05, but already a paid version (1650 rubles for 10 mailboxes, the demo version is limited to only 3 mailboxes), can be found on the website http://www.courierms.ru/. In this example we will configure and use free version mail server Courier Mail Server 1.56. Advantages of Courier Mail Server 1.56: free, easy to install and uninstall, compact, easy to administer, low consumption of system resources, multi-threading, convenient graphical shell, Russian-language interface and documentation, support for an unlimited number of mailboxes The program runs under Windows 9x/ME/NT/2000/XP. Setting up the program is quite simple and accessible to the average user. Note: in the example, all computers on the network are running Windows XP. All computers on the network are the same (there are no dedicated server computers). The teacher's computer is named kab39komp8, the students' computers are kab39komp1, kab39komp2, etc. All software discussed in this section is installed in the C:\MyServers\usr\local\ folder. If your computers have different names (and this is most likely the case 🙂), then take this into account when setting up the software. You can also select a friend folder to install the program. The CMS comes as a zip archive containing executable file and documentation. To install the server, create a folder in which it will operate, extract the files from the archive into this folder and run the CourierMS.exe application. When the server is launched for the first time, it will automatically create the subfolders and files necessary for its operation inside its folder. The server does not make any changes outside its folder. System Windows registry changes only when registering as a service. Courier Mail Server can be started as standard application, and also as Windows services. To run as a Windows service, start the CMS and in the Settings menu, select Start as a service. This will register the Courier Mail Server service in the system. If the startup occurs normally, the main server window will appear on the screen, and its icon will appear in the System Tray next to the clock. If messages about starting SMTP and POP3 servers appear in the main window and there are no error messages, you can start setting up the server. The next stage of setting up the mail server comes down to entering local domains. To do this, double-click on the word “domain” and a tab will open to configure it. Enter the name of the computer where the mail server will run. In our example this is kab39komp8. If your computer name is, for example, kab39komp5, then enter this name. Any server program involves entering users who will be served by it. Double click on "accounts" and the account editor will open. The account editor is designed to maintain a list of local users (accounts) of the server. When you create an account, a corresponding mailbox folder is also created. When you delete an account, the mailbox folder is automatically deleted along with all its contents. When you start the server for the first time, a postmaster account is automatically created. Create the required number of accounts for your users. It is enough to create one for each computer of the student and the teacher, although you can create a separate account for each student. Each account has the following settings: Real name: The name of the mailbox owner. Mailbox Name: The name of the mailbox. It is also the username when connecting to the server. Do not use Russian letters in the mailbox name and Special symbols, because Some email programs do not work with them correctly. If the mailbox name is kab39komp2, the local domain is m, then the email address of this user is kab39komp2@ kab39komp8. Password: password for connecting to the server. We will not change other parameters. We create user accounts based on the number of users. You can restrict access to the mail server using an IP filter. Specify the range of IP addresses to which access is allowed. For us it is 192.168.1.1-192.168.1.11 (Read about IP addresses and their configuration in other articles in this section). At your school, this range may be different, for example, the one that was given to you by your Internet provider (well, that’s another article).

All! The mail server can be used. You can read about setting up and using other features of the program in the help (in Russian!). You may ask: “how to use it? How to send and receive letters?” The answer is simple. We will send and receive letters using a program - an email client (Outlook Express, Thunderbird, etc.). Read about how to do this in the following article:

Setting up email clients for working with email

E-mail is a service that allows you to exchange electronic messages via a computer network.

You can work with email using mail program(mail client) installed on the user’s computer or using a browser using a web interface.

Mail program(e-mail client, mail client) - software installed on the user’s computer, designed to receive, write, send, store and process the user’s e-mail messages. Mail programs usually also provide the user with numerous additional functions for working with mail (selecting addresses from the address book, automatically sending messages to specified addresses, etc.).

The simplest email client - Microsoft program Outlook Express.

It is included in the standard Windows package (starting with Windows 98) and therefore is available on every computer running this operating system. In Windows Vista it was replaced by the Windows Mail email client. The Bat! is also widely popular among users! and the free email client Mozilla Thunderbird.

In the last article, we looked at how to set up and run a mail server in our class. Now let's set up email clients and test the operation of our local mail.

In order for the mail client to be able to send and receive mail, in its settings you need to specify the addresses of the incoming and outgoing mail servers, as well as the account parameters for connecting to the mailbox (name and password).

Setting up email clients must be done on all computers of users who need access to email via a mail server.

How to raise a mail server

Service for initial installation and configuration of a mail server on your dedicated physical or virtual server

Setting up and configuring the mail server is carried out taking into account the wishes of the customer, and according to the intended purposes of use.

It is possible to install a mail server individually technical specifications, according to specified requirements, options, purposes of use. Or based on one of the ready-made, standard templates for using a mail server.

It is possible to deploy an email server on physical and virtual (vps, vds) servers running Linux OS (Debian, CentOS, Ubuntu), FreeBSD and also Windows.

As part of the server installation, the following mandatory settings are made, regardless of additional functions:

Deployment of a mail server can be performed on the basis of one or several (in combination) licensed or open-source options software to organize a mail server.

Licensed software options:

  • Microsoft Exchange Server;
  • CommunigatePro;
  • Kerio MailServer;
  • MDaemon;
  • Sendmail

Software options licensed under GPL (free software) for organizing a mail server:

  • Sendmail (included in some Linux distributions);
  • Postfix;
  • Qmail;
  • Exim;
  • RoundCube;
  • Afterlogic

Installation possible software systems email and collaboration its capabilities are close to the licensed solution for corporate mail - Microsoft Exchange Server.

Cost of installing and configuring a mail server

Based on one of the existing, popular usage patterns:

2,900 rubles5,900 rubles8,900 rublesFrom 18,900 rubles

A small mail server for private use, for a blog, website or small organization.

Software used:

From 1 to 10 mailboxes, 1 mail domain, 1 server IP address;
filtering of incoming mail (Greylist + SpamAssassin), web-interface for accessing mail.

The server can be installed according to this template or according to yours (technical specifications), which are similar in characteristics and complexity.

Installing and configuring a mail server for a small organization or a medium-sized web project, for example, according to one of the following popular usage patterns, implying an increased number of mail users, mailboxes and mail domains:

Software used: Exim / Postfix, RoundCube / Afterlogic;

From 1 to 30 mailboxes, up to 2 mail domains, filtering of incoming mail (Greylist + SpamAssassin), web interface for working with mail, web statistics of mail server operation

Installing and configuring a corporate mail server for a small, medium-sized organization or web project, for example, according to one of the following popular usage patterns, which involve independent management of mailboxes, domains, users, their limits and rights:

Software used:

Data software solutions according to their characteristics, they are an alternative to the licensed product Microsoft Exchange Server and provide full opportunity to independently configure, maintain and manage an unlimited number of mailboxes, mail users, their rights and domains.

The mail server is managed via a web interface. A complete corporate email system for a company.

Installation and configuration of a mail server according to the customer’s individual technical specifications.

Example of a possible installation template:

A cluster of two remote physical or virtual mail servers that duplicate or complement each other’s capabilities.

Software used: Exim / Postfix, RoundCube / Afterlogic, etc.

Any required number of mailboxes, users and domains. Independent management of the mail server via the web interface. Working with incoming and outgoing mail from an email program or through a web interface.

To order and discuss setting up a mail server, please contact us from the “Contacts” section.

How to create your own mail server?

Kerio develops functional solutions for small and medium-sized businesses.
Kerio MailServer 6 belongs to the new generation of mail servers for corporate networks. The advantage of Kerio MailServer is its cross-platform - it can work in operating Windows environments, Linux, Mac OS, FreeBSD.

When working on Windows, you can use Microsoft Outlook as an email client, and on Mac OS, you can use Microsoft Entourage. In all systems you can use the Kerio WebMail web interface. There is also a version of Kerio WebMail Mini designed for installation on pocket computers. Kerio WebMail Mini supports Palm OS, Pocket PC and BlackBerry systems. Email clients Kerio WebMail and Kerio WebMail Mini are especially convenient for frequently traveling employees, as they allow you to work with mail on a corporate web server from anywhere. The second advantage of Kerio MailServer is the presence of a built-in antivirus and antispam module. For a mail server, such functionality is currently mandatory, and the integration of these functions within one product made it possible to achieve stability in operation and no need to integrate software from different manufacturers.

Mail

Kerio MailServer allows you to receive mail in several ways: via POP3 protocols (with the ability to SSL encoding), IMAP4 (with the ability to SSL encoding), using graphical network interface WebMail (with SSL encoding capability), using smartphones and PDAs, wireless connection using BlackBerry, as well as using email clients Microsoft Outlook 2000/XP/2003 for Windows or Microsoft Entourage X/2004 for Mac OS X. To work with groupware when using Microsoft Outlook requires the installation of Kerio Outlook Connector, which is an email application programming interface (MAPI provider) that replaces the Microsoft Outlook MAPI Provider.

When you replace Microsoft Exchange with Kerio MailServer, you retain access to shared calendar events, shared contacts, and tasks found in Microsoft Outlook, Microsoft Entourage, and Kerio WebMail. Users can migrate to Kerio MailServer while retaining all group features such as calendar events.

To automate the migration from Microsoft Exchange Server to Kerio MailServer, the Kerio Exchange Migration Tool function is designed, with which you can transfer data from the following Exchange series servers: Microsoft Exchange Server 5.5, Microsoft Exchange Server 2000, Microsoft Exchange Server 2003. This function imports data blocks “ Users”, “Email”, “Contacts”, “Calendar Events”, “Tasks” to the corresponding directories of the Kerio MailServer mail server.

Safety

The security system includes the ability to use cryptographic traffic protection using SSL, an anti-spam filter, an anti-virus filter and an attachment filter. All filters are managed in one section, “Attachment Filters,” which simplifies and speeds up the administrator’s work.

Kerio MailServer has two-level virus protection: you can simultaneously use the integrated McAfee antivirus and a plug-in external anti-virus package. In the event of a failure updating the databases or extending the license of one antivirus, the likelihood of infection is significantly reduced due to the work of the second. In the list of supported connectors antivirus programs are AVG Antivirus 7 ESE (Grisoft), NOD32 Antivirus (Eset Software), eTrust Antivirus (Computer Associates), SAVI Antivirus (Sophos), Avast Antivirus (ALWIL Software), VisNetic/Kaspersky Antivirus (Deerfield), Symantec AntiVirus Scan Engine (Symantec ). It is possible to use other antivirus programs. During virus outbreaks, it will be useful that the built-in McAfee antivirus also checks the internal corporate mail, which will slow down the spread of viruses inside among employees.

Kerio MailServer uses several methods to protect against spam. Supported SMTP authorization using IP address, real-time blacklists, content filtering, sender domain verification, Microsoft Caller ID. SPF identification is also supported. In addition, the software allows you to introduce restrictions on the number of parallel connections and limit the number of letters per unit of time sent from one address. Kerio MailServer implements technology to combat DHA attacks by slowing down responses, interrupting connections, and sending false responses. To enhance security, the product contains tools to Reserve copy for all incoming and outgoing email, address books, calendars and other collaboration objects, as well as tools for limiting mailbox volume, attachment size and the number of messages in general.

Administration

To install Kerio MailServer, a server platform is not required. The Kerio MailServer mail server can be used both as an internal network server and as an Internet email server. The product has two administration interfaces - Kerio Administration Console and Kerio Web Administration. The Kerio Administration Console allows you to manage multiple mail servers and other Kerio Technologies products from one workstation, and remote access is provided via an encrypted channel. This separate program, which can be installed on any supported operating system. The administrator can also delegate authority to users to manage accounts using Kerio Web Administration. User data in Kerio MailServer 6.x can be managed using an internal database or Microsoft directory services Active Directory or Apple Open Directory.

This tutorial will show you how to set up a working mail server in Ubuntu or Debian. As we know, the two main protocols used in the mail server are SMTP and POP/IMAP. In this tutorial, postfix will be used for SMTP, while dovecot will be used for POP/IMAP. They're both open source code, stable and have many settings.

Please note that mail server security issues are beyond the scope of this lesson and are covered in the article "".

Prerequisites

Each domain must have an entry for DNS server f. It is recommended NOT to use live domains for testing purposes. In this tutorial, the test domain example.tst will be used in a lab setting. The DNS server for this hypothetical domain would have at least the following entries.

  • Direct zone for example.tst:
IN MX 10 mail.example.tst. mail.example.tst. IN A 192.168.10.1
  • Reverse zone for example.tst:
192.168.10.1 IN PTR mail.example.tst.

When setting up a live mail server, these entries can be modified to suit system requirements.

Setting the hostname (hostname)

First, the mail server hostname must be defined in /etc/hostname and /etc/hosts. Moreover, only the host name should be placed in the first file.

Root@mail:~# vim /etc/hostname mail root@mail:~# vim /etc/hosts ## IP Fully Qualified Domain Name Hostname ## 192.168.10.1 mail.example.tst mail

Adding users

Every Linux user, by default, has an automatically created mailbox. These users and mailboxes will be used as mail accounts and their corresponding mailbox addresses. Creating a user is very simple.

Root@mail:~# adduser alex

Installation and configuration of SMTP

SMTP: Postfix installation

root@mail:/etc/postfix# vim main.cf ## server name ## myhostname = mail.example.tst ## defining aliases ## alias_maps = hash:/etc/postfix/aliases alias_database = hash:/etc/postfix /aliases ## transport definition ## transport_maps = hash:/etc/postfix/transport ## myorigin specifies the domain name for messages originating from this server. In our case, all outgoing emails must have "@example.tst" as the originating domain ## myorigin = example.tst ## mydestination parameter determines which domains this machine will deliver locally instead of forwarding to another machine. ## mydestination = mail.example.tst, localhost.example.tst, localhost, hash:/etc/postfix/transport ## smarthost address. It is not used in this lesson, it will be discussed in a future instruction ## relayhost = ## trusted networks of the sender. postfix will not forward emails coming from other networks ## mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.10.0/24 ## mailbox size in bytes. 0 means no limit ## mailbox_size_limit = 0 ## postfix will listen on all available interfaces, for example eth0, eth1, eth2 and so on ## inet_interfaces = all
  • transport

Emails destined for the example.tst domain are determined to be delivered locally without any DNS queries.

Root@mail:/etc/postfix# vim transport example.tst local: .example.tst local: root@mail:/etc/postfix# postmap transport

  • aliases

We assume that all letters sent to user userA should also be delivered to user userB, for this the aliases file is modified as shown below:

Root@mail:/etc/postfix# vim aliases userA: userA, userB root@mail:/etc/postfix# postalias aliases

Please note: The "userA:userB" synth specifies that mail should only be directed to userB. UserA will not receive a copy of the email.

SMTP: Startup and Maintenance

postfix can be started with the command.

Root@mail:~# service postfix restart

The log file in /var/log/mail.log should provide useful information if something goes wrong. You can also check whether the mail server is listening on TCP port 25 using netstat.

Root@mail:~# netstat -nat tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN

As you can see from the output, the server is listening on TCP port 25 for incoming connection requests.

Installing and configuring POP/IMAP

POP/IMAP: Installing dovecot

POP/IMAP: Preparing configuration files

The following parameters change as needed.

Root@mail:~# vim /etc/dovecot/conf.d/10-mail.conf ## location of mailboxes specified in the "mbox" format ## mail_location = mbox:~/mail:INBOX=/var/mail/ %u ## dovecot given necessary permissions to read/write user mailboxes ## mail_privileged_group = mail

This should be enough to start the POP/IMAP service on the mail server.

POP/IMAP: Service Installation

Now that dovecot is installed and configured, it can be launched using the following command.

Root@mail:~# service dovecot restart

Again, the log file (/var/log/mail.log) can provide important clues if something goes wrong. You can find out if dovecot is running by using netstat as follows.

Root@mail:/etc/dovecot/conf.d# netstat -nat tcp 0 0 0 0.0.0.0:110 0.0.0.0:* LISTEN tcp 0 0 0 0.0.0.0:143 0.0.0.0:* LISTEN

Using a mail server with a custom mail program

The mail server is now ready for use. Postal Account can be configured using your favorite email client on desktop computer, laptop, tablet or phone. You can also configure webmail (mail with a web interface) on the server, but instructions for webmail will be in the following lessons. At this stage, the Mozilla Thunderbird mail program has defined the following settings for my server:

Troubleshooting mail server problems

  • Your best friend is the log file /var/log/mail.log. Any clues as to why the mail isn't working can be found here.
  • Make sure your firewall is properly configured.
  • Make sure the DNS server has the proper entries.

To summarize, the demonstration in this lesson, as already mentioned, took place in a laboratory setting. A test DNS server with all the necessary records can be deployed, and users will exchange letters with each other on the same server, for example, the same domain. To make it even more interesting, you can deploy many mail servers with different domains, to test the communication between domains, for this the necessary DNS records.

Valid DNS records are required for live mail servers. You can tune the postfix and dovecot settings according to your needs.

Attention A: For those who want to deploy a live mail server, or any mail server that has Internet access, make sure your SMTP is secure. Typically, attacks on SMTP come from the Internet and from malicious programs within the local network.

Hope this helps.

These programs cannot be installed on virtual hosting. A completely autonomous mail server can only be created on a virtual private (dedicated) server, i.e. on a VDS (VPS). - this article, as the title suggests, will tell you about a high-quality and at the same time the cheapest option for a virtual private server, which also uses cloud technologies.

In general, the topic of mail is very close to the authors; at different times we have already considered the issues of creating mail on our own domains(this allows you to choose short and beautiful names for mailboxes), how to “attach” your domain to mail.ru and indeed to any popular mailbox, how to create your own offline mail on hosting, etc. All this and much more you You can find your email by tag.

Many Ubuntu users use the system not only for home needs. This approach is quite justified, because on Linux systems it is much more convenient to do programming, create servers and websites. One of the conveniences is creating an email server. For beginners, this task will seem terribly difficult, but if you figure out how to install and configure a mail server for Ubuntu, the task will not seem so difficult to you.

How to configure a mail server based on Ubuntu.

Before specific instructions and wandering through the code, you can’t do without some theoretical material. It is important to understand what an email server is and how it works.

A configured mail server, to put it very simply, is a postman that receives a “letter” from one mail client and gives it to another. This is, in principle, the whole essence of how this software works. A mail server is needed for more than just sending email. On sites, he is responsible for registering users, sending filled out forms and other important actions, without which the site would become like a book that you can only look at while turning the pages, but it’s difficult to do anything.

Mail servers on Linux differ significantly from those on Windows and other systems. On Windows, this is a ready-made closed program that you just need to start using. Linux distributions assume self-configuration all components. Moreover, the server will ultimately consist not of one program, but of several. We will be using Postfix in combination with Dovecot.

Why Postfix?

There are several email clients on Ubuntu, but we chose this one. Setting up Posfix on Ubuntu is much easier than setting up SendMail, and this is important for a novice user. Combined with Dovecot, Postfix is ​​capable of doing everything that is usually required of mail servers.

Postfix is ​​the mail transfer agent itself. He will play the main role in the entire performance. It is an open source program that many servers and websites use by default. Dovecot is a mail delivery receiving agent.

Installing Postfix

The first step is to use the command to update the local package database:

The Postfix agent itself can be freely installed from the repository, and this is the next step:

sudo apt-get install postfix

When the interface of this application starts, you need to select the “Internet Site” item, after which a configuration file named main.cf will be created.

Next, in the “System mail name” field, enter the local name of the future server, for example, myserver.org or any other at your discretion. Using the nslookup command, you can always find out the server domain in the future - look and write it down, this will be useful for configuration.

Setting up Postfix

Now you need to configure the mail agent. To do this, you first need to create a file called virtual in the /etc/postfix// folder. To do this, you can use the touch command:

Now you need to create a private folder in the /etc/postfix/ directory. Mail settings will be stored in it:

touch canonical sender_relay sasl_passwd

Now you need to change some settings in the main.cf configuration file. Open it in Notepad in privileged mode:

sudo nano /etc/postfix/main.cf

The file contains the parameter values, and its values ​​are listed through the “=” sign. Here you need to change the name of the myhostname parameter local server– to myserver.org, as in our example, or to the one you specified when installing Postfix in the previous step. Like this:

myhostname = myserver.org

View the IP address in use with this command:

ifconfig | grep “inet addr” -m 1

This IP address must be entered into the mydestination parameters. Replace the alias_maps parameter with virtual_alias_maps, then letters can be forwarded to other addresses.

Now you need to change the location of the hash:

virtual_alias_maps = hash:/etc/postfix/virtual

Set the mynetworks parameter to the following values:

mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

If you want the server to be able to work with Yandex mail, add the following parameters at the end of the file:

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/private/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_type = cyrus
smtp_sasl_mechanism_filter = login
smtp_sender_dependent_authentication = yes
sender_dependent_relayhost_maps = hash:/etc/postfix/private/sender_relay
sender_canonical_maps = hash:/etc/postfix/private/canonical

In the /etc/postfix/private/canonical file, add your Yandex mail:

@yandex.ru [email protected]

Add to the /etc/postfix/private/sender_relay file:

@yandex.ru smtp.yandex.ru

In the /etc/postfix/private/sasl_passwd file, add the password for your Yandex mailbox - instead of ***:

[email protected]:***

If you are using Ubuntu Server 16, you need to open ports for mail services to work. To do this, use the command:

iptables -A INPUT -p tcp –dport 25 -j ACCEPT

When you have made all the changes to the files, you need to restart the service for the new settings to take effect.

Checking Postfix operation

It is useful to install the mutt utility to make working with mail more convenient. This can be done using the command:

sudo apt-get install mutt

Now you can try sending a letter to some mailbox:

echo “Message” | mutt -s “msg” [email protected]

If all is well, the letter will be received. But keep in mind that Google usually classifies such emails as spam.

Installation and configuration of Dovecot

First you need to install the utility:

sudo apt-get install dovecot-imapd dovecot-pop3d

Now open the file /etc/dovecot/dovecot.conf and add a list of protocols to it:

protocols = pop3 pop3s imap imaps

mail_location = mbox:~/mail:INBOX=/var/mail/%u

If this line has different content, you need to change it to the specified one. If it is not there at all, then you need to add it.

Restart the service for the changes to take effect:

sudo /etc/init.d/dovecot restart

Open the /etc/hosts file and add your domain there, which you specified at the very beginning. In our example, this was the domain myserver.org. The IP address was also determined during the Postfix configuration step.

ip-address myserver.org

Now all that remains is to open the ports so that postal services can easily receive and send letters:

iptables -A INPUT -p tcp –dport 220 -j ACCEPT
iptables -A INPUT -p tcp –dport 993 -j ACCEPT
iptables -A INPUT -p tcp –dport 110 -j ACCEPT
iptables -A INPUT -p tcp –dport 995 -j ACCEPT

To check the functionality of this entire system, you need to send a letter to the mailbox specified in the settings. In this case, the created domain must be used in the address, and the user must be created in advance, then the letter should be received - you can check mail using the mutt utility, which you have already installed.




Top