Internet Windows Android

Configuring Sendmail. Installing and configuring Sendmail in Ubuntu Installing and configuring sendmail ubuntu

It appeared back in 1983, but it is actively used to this day. Key features include support for many of the platforms that exist today, as well as being free. The app comes with open source code. This means that everyone can add their own functionality to it, or change at will. In the Ubuntu operating system, Sendmail, which is configured through the Linux command line, has taken root thanks to its good support and rich features.

The message processor - Sendmail - is widely used in business.

Today, the "message processor" Sendmail Sentrion, which was created taking into account the needs of large companies, is quite common. Its distinctive features are high productivity and good integration with all business processes. Sentrion offers, along with new technologies, legacy applications that have taken root well. Also, the app is friendly enough to suit home users.

Program installation

You need to install Sendmail on the basis of a local server or web server. In the second case, the mail agent will be more functional. To get all the components of a web server, you need a stack of LAMP components. It can be found in the repository.

IMPORTANT. Before installing new software, do not forget to update the package lists in the local repository using the command

"$ Sudo apt-get update"

The installation of Sendmail begins with the "sudo apt install sendmail" command, which will download the mail agent packages.

"Mcedit / etc / hosts"
"Sudo sendmailconfig"

After that, you need to restart the services of the program itself, as well as the Apache web server:

Sudo /etc/init.d/sendmail restart
"Sudo /etc/init.d/apache2 restart"

If necessary, you can install the utilities for working with mail:

"Sudo install mailutils"

We check the performance testing of the entire system:

"Mail your_mail< /dev/null»

where "your_mail" is the current postal address.

Finally, let's check the log file. This is the mail service file where installation errors will be displayed:

Tail -f /var/log/mail.log

It remains only to go to the e-mail box. There should already be a test message in it.

So, you've learned more about the Ubuntu program Sendmail, which turned out to be quite easy to configure. If you have questions about other aspects of working with programs for Linux - look for answers to them on the pages of our site!

The book describes in detail the settings of network services that allow you to create a server of the required configuration and functionality based on the Linux OS. You can set up any type of server: from a local network server to an Internet server and a remote access server. Linux administration is described in detail.

The presentation is based on the Red Hat and Mandrake distributions. A lot of unique information: running Windows games under Linux and creating a Linux server for a gaming hall, setting up Dr. Web and AVP for Linux, MRTG traffic accounting software, LIDS protection and detection system, and much more. Particular attention is paid to the security of Linux servers. The Linux OS itself is described in sufficient detail and a reference to its commands is provided. After reading the book, you will become the owners of knowledge on configuring and compiling the kernel, creating your own rpm packages, the bash shell, and using RAID arrays. You will get to know the inner world of Linux. The book is suitable for both professional and novice administrators, since the presentation of the material begins with the installation of Linux OS, and the first chapter describes the basic network technologies and protocols (Young Administrator Course).

All listings in this book have been tested in practice and can be found on the enclosed CD. In addition, it contains a lot of reference information (HOWTO, RFC), as well as articles on Linux. A rich set of auxiliary utilities and software for the server is located (Apache, MySQL, MRTG, etc.).

Book:

If you are using a RedHat compatible distribution, then you will need to install the appropriate packages. I am using sendmaiI-8.11.0 and imap-4.7c2. The latest version of sendmail can be downloaded from the Internet at http://www.sendmail.org.

Before you start configuring sendmail, you need to properly configure DNS. DNS server setup was discussed in detail in Ch. 10. If you are only configuring a mail server, you do not need to configure a DNS server on the same computer. It will be enough to specify the DNS servers of your network in the / etc /resolv.conf file for the name resolution system to work correctly. However, sendmail can be configured to work without using DNS, but I will not consider this option.

To get started with basic sendmail configuration, run the netconf utility (see Figure 13.1). It works from both the X-Window and the console. The netconf utility is available in RedHat Linux, Mandrake, ASPLinux and other distributions, but it certainly is not in KSI Linux. Naturally, you must be logged in as root. If you don't have netconf, you will have the great pleasure of manually editing the /etc/sendmail.cf file. This file is where all sendmail settings are stored.


Fig. 13.1. Netconf configurator

Select Mail delivery system from the menu, then Basic sendmail configuration. In the Present your system as field, just enter your domain name. Then be sure to check the "Accept email for your_domain.com" box (see Figure 13.2). If you don't, your server will be able to redirect messages to another server. At the same time, excess traffic will go through your server, which you do not need at all. Once upon a time there was even this kind of rejection attack via email. Its principle is as follows: a letter is sent from a non-existent user [email protected] another non-existent user [email protected] The letter is sent through the hostcom computer, which allows the message to be redirected (the "Accept email for domain.com" mode is not enabled). The mail server of the domain B.com sends a message to the address [email protected] that the user [email protected] does not exist. In turn, the mailer of the A.com domain informs that the user [email protected] also does not exist and sends a message to the address [email protected] Indirect recursion occurs. Now imagine that such a message is not one, but, say, 100 and the volume of each is at least 1 MB! As a result, one of the servers in the domain1.com - host.com - domain2.com chain should crash.


Rice. 13.2. Basic sendmail configuration

Sorry, I'm off topic a bit, let's continue configuring sendmail. Set the message sending protocol to smtp (Mail gateway protocol).

This information is already enough to get your sendmail up and running. You can set additional options for the sendmail program using netconf.

Now make it so that sendmail only accepts mail from authorized addresses. To do this, you don't even need to configure sendmail itself - you just need to tweak the /etc/hosts.allow and /etc/hosts.deny files. The first of them contains a list of hosts that are allowed access to this machine, and the second contains a list of hosts that are denied. Please note: despite the name - "Allowed" or "forbidden", the restrictions that are set by the first file are much stricter. For example, to deny access to all hosts except computers on your network, add the line 192.168.1 to the /etc/hosts.allow file.

Here we mean that the network has an address of 192.168.1.0 and a mask of 255.255.255.0. You can read more about the format of the hosts.allow and hosts.deny files by entering the command man hosts.allow.

Now it's POP3's turn. After installing the imap package, you have almost everything set up, i.e. I want to say that it is already possible to check the configuration. Restart the inetd or xinetd daemon, whichever you are using, and enter the following:

telnet<имя_только_созданного_почтовика> 25

In response, you should see something like the following:

Trying 192.168.1.1. ... ...
Connected to 192.168.1.1
Escape character is
220 de.dhsilabs.com ESMTP Sendmail 8.11.0 / 8.8.7 Sun, 17 Jun
2001 10:54:22 +300

This means that sendmail is working, it remains to be seen how well it does it. To do this, enter something like the following:

mail from: [email protected]
220 2.1.0 [email protected]…. Sender Ok
rcpt to: [email protected]
220 2.1.5 [email protected]…. Recipient Ok

After that enter the data command, then the text of the message, and to end the entry, put a period in an empty line. Sendmail will inform you that the message has been sent (more precisely, it has been placed in the send queue). Recording [email protected]- the name of the user to whom you are sending mail. The user must really exist. The den.dhsilabs.com entry is the name of your mailer.

Note. Names [email protected] and dhsilabs.com are given as examples. You must provide your own values ​​instead.

Please note that there is no my.host.com host in nature, and the sendmail program reports that "Sender Ok". That is why it is better to enable the Wait for DNS option in the sendmail settings.

Now you need to launch some mail client, for example kmail, and receive mail. Use the following network settings in kmail program: Network? Sending mail, set SMTP, port 25, server name - the name of your mailer, in this example it is den.dhsilabs.com. Then add an account for POP3:

Username - den

Password - the password that is used to log in to the system.

Server - den.dhsilabs.com

As a result, you should receive the message that you entered after data. However, there may be problems in resolving the name. To avoid them, you need to configure DNS correctly or use its IP address instead of the name of the mail server. When adding a new user, be sure to set their login password. If you do not do this, but try to receive mail without specifying a password, you will receive an "Authentication Failed" message.

Basic configuration of sendmail is very easy using the configurator, but sometimes basic configuration is not enough. For more precise configuration, you need to familiarize yourself with the configuration files of the sendmail program.

Note. In most cases, you will be satisfied with the basic setting until spammers take you under their "protectorate" - then you will need to read Ch. 23 on methods of protection against spam. However, one of Murphy's laws may work - no sendmail configurator will be developed for your system, and then you still have to deal with configuration files.

The main sendmail configuration file is /etc/sendmail.cf. On some distributions, this file is located in the / etc / mail directory. It is said about this file that it is longer than Bill Gates's limousine and that it is edited in the "eyes are afraid, hands are doing" mode. If you do not believe me, open this file and you will be convinced of it. Only professional administrators or sendmail developers can edit this file manually.

Typically, the m4 macro processor is used to edit this file. First, you prepare a special mc file. This file contains the .sendmail settings, but in a more "readable" form. When editing configuration files, their size also affects. For comparison, my mc file is 2459 bytes, and my sendmail.cf file is 46302 bytes. It's one thing to edit a two kilobyte file, and quite another when the file size is 46 kilobytes. Unlike the sendmail configuration file, you will immediately understand what a particular mc file is for. Then, after editing the mc file, you need to run the m4 macro processor to create the sendmail configuration file:

m4 my_config.mc> /etc/sendmail.cf

Before running this command, I highly recommend that you save the sendmail.cf source file somewhere. In case of incorrect settings, you can always restore it.

The default configuration file that is used by the T4 macro processor to create the sendmail program configuration file (sendmail.cf) is located in the / usr / share / sendmail-cf / cf directory. In older versions of the sendmail program, it may be located in the / usr / lib / sendmail directory.

Typically, this file is called sendmail.mc. It can sometimes be called differently, for example, redhat.mc, if you are using the Red Hat operating system or compatible with it.

An example of a standard /usr/share/sendmail-cf/cf/redhat.mc file is shown in Listing 13.1.

Listing 13.1. Standard redhat.mc file

divert (-1)
dnl This is the sendmail macro config file. If you make changes to this file,
dnl you need the sendmail-cf rpm installed and then have to generate a
dnl new /etc/sendmail.cf by running the following command: dnl
dnl m4 /etc/mail/sendmail.mc> /etc/sendmail.cf
dnl
include ("../ m4 / cf.m4")
VERSIONID ("linux setup for Red Hat Linux") dnl
OSTYPE ("linux")
define ("confDEF_USER_ID", "8:12") dnl
undefine ("UUCP_RELAY") dnl
undefine ("BITNET_RELAY") dnl
define ("confAUTO_REBUILD") dnl
define ("confTO_CONNECT", "1m") dnl
define ("confTRY_NULL_MX_LIST", true) dnl
define ("confDONT_PROBE_INTERFACES", true) dnl
define ("PROCMAIL_MAILER_PATH", "/ usr / bin / procmail") dnl
define ("ALIAS_FILE", "/ eto / aliases") dnl
dnl define ("STATUS_FILE", "/ etc / mail / statistics") dnl
define ("UUCP_MAILER_MAX", "2000000") dnl
define ("conf USERDB_SPEC", "/etc/mail/userdb.db")dnl
define ("confPRIVACY_FLAGS", "authwarnings, novrfy, noexpn, restrictqrun") dnl
define ("confAUTH_OPTIONS", "A") dnl
dnl TRUST_AUTH_MECH ("DIGEST-MD5 CRAM-MD5 LOGIN PLAIN") dnl
dnl define ("confAUTH_MECHANISMS", "DIGEST-MD5 CRAM-MD5 LOGIN PLAIN") dnl
dnl define ("confTO_QUEUEWARN", "4h") dnl
dnl define ("confTO_QUEUERETURN", "5d") dnl
dnl define ("confQUEUE_LA", "12") dnl
dnl define ("confREFUSE_LA", "18") dnl
dnl FEATURE (delay_checks) dnl
FEATURE ("no_default_msa", "dnl") dnl
FEATURE ("smrsh", Vusr / sbin / smrsh ") dnl
FEATURE ("mailertable", "hash-o /etc/mail/mailertable.db")dnl
FEATURE ("virtusertable", "hash –o /etc/mail/virtusertable.db")dnl
FEATURE (redirect) dnl
FEATURE (always_add_domain) dnl
FEATURE (use_cw_file) dnl
FEATURE (use_ct_file) dnl
FEATURE (local_procmail, "", "procmail –t –Y –a $ h –d $ u") dnl
FEATURE ("access_db", "hash –o /etc/mail/access.db")dnl
FEATURE ("blacklist_recipients") dnl
EXPOSED_USER ("root") dnl
dnl This changes sendmail to only listen on the loopback device 127.0.0.1
dnl and not on any other network devices. Comment this out if you want
dnl to accept email over the network.
DAEMON_OPTIONS ("Port = smtp, Addr = 127.0.0.1, Name = MTA")
dnl NOTE: binding both IPv4 and IPv6 daemon to the same port requires
dnl a kernel patch
dnl DAEMON_OPTIONS (xport = smtp, Addr = :: 1, Name = MTA-v6, Family = inet6 ")
dnl We strongly recommend to comment this one out if you want to protect
dnl yourself from spam. However, the laptop and users on computers that
do dnl not have 24x7 DNS do need this.
FEATURE ("accept_unresolvable_domains") dnl
dnl FEATURE ("relay_based_on_MX") dnl
MAILER (smtp) dnl
MAILER (procmail) dnl
Cwlocalhost.localdomain

The FEATURE directive can be used to connect one or another function of the sendmail program. For example, the mailertable function is designed to override routing for specific domains. You can easily extend the functionality of the sendmail program by adding the functions you want to the mc file.

Suppose you want to hide the names of the computers in the domain. This is easily achieved by adding the masquerade_envelope function to your mc file. To do this, copy the redhat.mc file to the hide_hosts.me file and add the following lines to the end of the hide_hosts.me file:

MASQUERADE_AS (my-domain.ru) dnl
FEATURE (masquerade_envelope) dnl

Then run the command:

m4 /usr/share/sendmail-cf/cf/hide_hosts.me> /etc/sendmail.me

That's all! The node names will be hidden. The description of other functions is presented in table. 13.1.

Sendmail Functions Table 13.1

Function Description
access_db Defines the access table. This table lists the hosts that are allowed or denied to send mail through your mail server. This option is effectively used to combat spam. Spam protection is discussed in detail in the section of the same name in Ch. 23
accept_unresolvable_domains Allows sending mail to domains that cannot be recognized
bestmx_is-local Messages will only be accepted if the MX DNS server record points to this mail server
blacklist_recipients "Black list". Another option for fighting spam. The access_db option is required for it to work.
dnsbl Used to work with the black list, dnsbl is an abbreviation for DNS Black List. In earlier versions, this option was called (Resolve Black List)
domaintable Used to resolve domain names
genericstable Used to change the sending address in messages
local_procmail Indicates that mail should be delivered using the local procmail utility
mailertable Overrides routing for specific domains
masquerade_entire_domain Used to mask (hide) the entire domain. This function must be used in conjunction with the MASQUERADE AS (or MASQUERADE_DOMAIN) directive, for example, MASQUERADE_AS (f117.ru) dnl
masquerade_envelope Allows you to hide the hostnames of the domain. Replaces the received from field of the message header before transmitting the message to others
redirect Used to redirect to another mail server. Means refusal to accept mail with the issuance of a message please try
(try to use this address)
relay_based_on_MX Allows mail forwarding (relaying) only for hosts specified in MX DNS server records
relay_hosts_only Allows relaying only for nodes specified in access_db
relay_mail_from Allows relaying only if the sender is listed in the RELAY list of accessdb
smrsh Using the limited sendmail shell
use_cf_file When this function is specified, sendmail will look in the sendmail.cf file for a list of trusted users.
use_cw_file When this function is specified, sendmail will look in the sendmail.cw file for a list of local hosts.
virtusertable Converts the recipient's address to the address of a local user

The /etc/mail/sendmail.cw file lists all the aliases for a given mail server. Suppose your server name is mail.dhsilabs.ru. If the sender sends mail to the address [email protected], the letter will be delivered to the user den without any problems. And if someone sends a letter to the address [email protected], then its delivery will cause certain difficulties, since it is not clear to which node of the dhsilabs domain the message is addressed? To solve this problem, you need to put a line in the sendmail.cw file.

You hardly need web server that cannot send mail from your site. Below is a simple way to quickly deploy sendmail as an MTA (Mail Transfer Agent) that sends mail for the site.

To start installation

Sudo apt-get install sendmail

The second and most important thing is the correct configuration of the host itself. The mailer needs to know clearly what DNS FQDN name the host has and that it exists on the vast world network.

Suppose the server on which sendmail works has an IP address 123.123.123.123

We also have the domain name domainame.com, which is correctly delegated to the server's IP address.

Editing the file / etc / hosts so that the server knows its own DNS name (of course, it must be correct and real)

Sudo nano -w / etc / hosts

The second line, which should be added, is the description of the server domain name, its comparison with the real IP address of the host and the internal system name:

127.0.0.1 localhost 123.123.123.123 box1.domainname.com your-web-server

Then you need to make a change to the file / etc / hostname

Sudo nano -w / etc / hostname

And enter the correct server name there, which was entered in / etc / hosts in our example, this is your-web-server.

Content of / etc / hostname file after editing:

Your-web-server

After these steps, you need to restart the server or run:

/etc/init.d/hostname restart And run 2 commands: hostname hostname -f

If everything is correct, the system should return the same names in both cases: your-web-server

Advise check the sending of the letter thus

# telnet localhost smtp gives us: Trying :: 1 ... Trying 127.0.0.1 ... Connected to localhost. Escape character is "^]". 220 localhost6.localdomain6 ESMTP Sendmail 8.14.3 / 8.14.3 / Debian-9.2ubuntu1; Thu, Dec 9 2010 15:31:17 +0200; (No UCE / UBE) logging access from: localhost.localdomain (OK) - localhost.localdomain enter: HELO localhost gives us: 250 localhost6.localdomain6 Hello localhost.localdomain, pleased to meet you enter: MAIL FROM: [email protected] it gives us: 250 2.1.0 [email protected] Sender ok enter: RCPT TO: [email protected] it gives us: 250 2.1.5 [email protected] Recipient ok we enter: DATA gives us: 354 Enter mail, end with "." on a line by itself, enter test message. I hope that you guessed that the above mail should have been replaced with your last one that telnet writes to us 250 2.0.0 oB9DVHsE004837 Message accepted for delivery

As a result of executing a sequence of commands to the specified e-mail ( [email protected]) a message should come ("test message").

Php.ini setup

gedit/etc/php5/apache2/php.ini

Find and edit the next line

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

Checking the mail () function

echo mail (" [email protected]"," test message "," test message "," From: [email protected]"); ?>

The setup is complete, I hope you succeed configure Sendmail on Ubuntu

Installation and configuration guide for one of the oldest MTA (Mail Transfer Agent), a program for sending e-mail - sendmail which is available for installation on any operating system. On many OSes sendmail is installed by default and there is no special need to change this standard MTA to another. At the same time, the same PHP is configured by default to work with this MTA. If setting up sendmail takes a long time - put postfix (), there is no need to waste a lot of time.

Preparation

Check if you have sendmail installed and not exim4 or another MTA:

Ls -la `which sendmail` # lrwxrwxrwx 1 root root 26 2011-01-17 19:58 / usr / sbin / sendmail -> / etc / alternatives / sendmail

Installation

sudo apt-get install sendmail sasl2-bin

Configuring / etc / hosts

127.0.0.1 localhost localhost.localdomain e5530
Note

You must specify your main host (computer name, mine is e5530) and localhost.localdomain, otherwise you will receive an error: My unqualified host name (myhostname) unknown; sleeping for retry "and" unable to qualify my own domain name (e5530) - using short name, sendmail takes a long time to start and sends mail slowly. Possibly host localhost.localdomain can be skipped, not sure.

After that, you need to specify the names of local hosts, from which sendmail will accept requests to send email messages, in the / etc / mail / local-host-names file:

AuthInfo: smtp.gmail.com "U: [email protected]"" I: [email protected]"" P: YourPass "" M: PLAIN "AuthInfo: smtp.gmail.com: 465" U: [email protected]"" I: [email protected]"" P: YourPass "" M: PLAIN "

Note

Instead of port 465, you can try to knock on 587 (if there are problems with authorization):

AuthInfo: smtp.gmail.com: 587 "U: [email protected]"" I: [email protected]"" P: YourPass "" M: PLAIN "

Chmod 600 / etc / mail / auth / *

Sendmail.mc config

Config file /etc/mail/sendmail.mc. Compare your config. It should be something like this .. The order of the instructions is important!

Dnl # include (`/etc/mail/m4/dialup.m4") dnl include (`/etc/mail/m4/provider.m4") dnl include (`/etc/mail/tls/starttls.m4") dnl include (`/etc/mail/sasl/sasl.m4") dnl FEATURE (`authinfo", `hash / etc / mail / auth / client-info") dnl define (`SMART_HOST", `smtp.gmail.com" ) dnl define (`RELAY_MAILER_ARGS", `TCP $ h 587") dnl define (`ESMTP_MAILER_ARGS", `TCP $ h 587") dnl dnl # dnl # Default Mailer setup MAILER_DEFINITIONS MAILER (`local") dnl MAILER (`smtp" ) dnl define (`confAUTH_MECHANISMS", `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN") dnl # dnl define (`confDOMAIN_NAME", `e5530") dnl

Using the sendmail config

cd / etc / mail sudo su # just sudo won't work! m4 sendmail.mc> sendmail.cf makemap -r hash authinfo.db< auth/client-info make /etc/init.d/sendmail restart # Перезагрузка конфига

Problems and solutions

If everything is configured correctly, but messages go to the "pending queue" and are not relayed to another SMTP:

  1. Check your IP "schnick in the blacklists. You can check the banned IP here at smart-ip.net, my IP got into the spamhaus database" a.
  2. Check if your provider is blocking outgoing packets on port 25.
Problems with Intertelecom!

I didn’t manage to configure message relay on GMail via sendmail on Intertelecom connection - sendmail stubbornly knocked on port 25, which is closed by the ISP. I had to configure postfix.

PHP configuration (if needed)

Specify sendmail launch parameters in /etc/php5/apache2/php.ini config (/etc/php5/cli/php.ini):

## Configuring sendmail for PHP: sendmail_path = / usr / sbin / sendmail -t; sendmail_path = "/ usr / sbin / sendmail -t -f [email protected]-i "

Let's check the settings

echo "Message text" | mail -s "Subjet" [email protected] sendmail -t [email protected]-f [email protected]-v -i< ~/mail-body.txt

To test postfix, try sending multiple messages from the console. I have described how to do this in this article: "".

Sendmail management

View the entire message queue:

Sudo mailq

View the message queue at a specific address:

Sudo mailq | grep " [email protected]"| wc -l

Clear the entire sendmail message queue:

Sudo rm -r / var / spool / mqueue-client / *

Clear the sendmail message queue at destination:

Cd / var / spool / mqueue ls | xargs -ti sh -c "grep" [email protected]"" () "> / dev / null && rm -f" () ""

#sendmail, #LAMP, #MTA

P.S. If you want to learn the Linux console at a fairly good level, I recommend reading the fresh book by Denis Kolisnichenko “ Linux command line and automation of routine tasks».

First, a little digression

SMTP - Simple Mail Transfer Protocol - a service in TCP / IP networks for transferring messages (i.e. mail). Typically port 25 is used for SMTP (see / etc / services file)

POP - Post Office Protocol - is used to receive mail from the server. The default port is 110 (for POP3 protocol)

Now I will try to explain how to set up a small mail server using POP3 and SMTP.

First, we will install the necessary software. We need sendmail and imap. If you are using an RH-compatible version of Linux, you will need to install the appropriate packages.
I use
sendmail-8.11.0
imap-4.7c2

Before you start configuring sendmail, you need to configure DNS correctly, otherwise this program will not work correctly (although you can configure sendmail to work without using dns).

Let's make the basic configuration of sendmail. To do this, you need to run the utility
netconf... It works both from under X and from under the console.
The netconf utility is in RH, Mandrake - I don't know for sure about other versions. (it is not available in KSI Linux). Naturally, you must be logged in as root.

Select from the menu Mail delivery system, then Basic sendmail configuration
In the Present your system as field, just enter your domain name
Then check the box Accept email for ...
Set the message sending protocol to smtp ( Mail gateway protocol)

This information is already enough to get your sendmail up and running.
You can set additional options for the sendmail program with
netconf. If you don't have sendmail, you will have an unforgettable
the pleasure of manually editing the /etc/sendmail.cf file - in it
the settings are stored) :)

Now let's make it so that sendmail only accepts mail from authorized
addresses. To do this, you don't even need to configure sendmail itself - you only need to
correct files /etc/hosts.allow and /etc/hosts.deny
The first one contains a list of hosts that are allowed to access this
the car, and in the second it is prohibited. Please note: despite the name
(allowed | denied), restrictions that are set by the first file
much stricter.

Example. To deny access to all hosts except your computers
networks in the /etc/hosts.allow file add the line
"192.168.1.
Here we mean that the network has the address 192.168.1.0 and the mask 255.255.255.0
You can read more about the hosts.allow and hosts.deny file format,
by entering the command man /etc/hosts.allow

In order to receive mail only from "your" domains, you need to add to
mc file (usually /etc/mail/sendmail.mc) the following lines (use
tabs, not spaces)
LOCAL_CONFIG
FR-o /etc/sendmail.cR

LOCAL_RULESETS
Scheck_rcpt
# anything terminating locally is ok
R< $+ @ $=w > [email protected] OK
R< $+ @ $=R > [email protected] OK

# anything originating locally is ok
R $ * $: $ (dequote "" $ & (client_name) $)
R $ = w [email protected] OK
R $ = R [email protected] OK
[email protected] [email protected] OK

# anything else is bogus
R $ * $ # error $: "550 Relaying Denied"

Now create a file /etc/sendmail.cR and enter the names of "your" domains into it -
one in each line.
Only for these domains the mailer will be able to receive mail - everyone else will receive
550 Relaying Denied message

Now it's POP3's turn. After installing the imap package, you have practically
everything is set up, i.e. I want to say that it is already possible to check the configuration.

First, restart the inetd daemon
After restarting it, the sendmail and popd services will be activated (more precisely
one sendmail and popd is called as needed)

Try the following:
enter telnet<имя_только_созданного_почтовика> 25
You should see something like this:
Trying 192.168.1.1 ...
Connected to 192.168.1.1
Escape character is "^]"
220 de.dhsilabs.com ESMTP Sendmail 8.11.0 / 8.8.7 Sun, 17 Jun 2001 10:54:22 +300

This means that sendmail is working, it remains to be seen how correct :)

Introduce
mail from: [email protected]
220 2.1.0 [email protected].... Sender Ok
rcpt to: [email protected]
220 2.1.5 [email protected].... Recipient Ok
Now we enter data, then the text of the message, to end the entry we put a period
on an empty line

Sendmail will inform you that the message has been sent (more precisely, it is placed in
queue for departure)

[email protected]-name of the user to whom I am sending mail.
den.dhsilabs.com - the name of my mailer
Please note that there is no my.host.com host in nature, but Sender Ok.
That is why, in the sendmail settings, it is better to enable the Wait for DNS option

Now you need to start some mail client for example kmail
and pick up the mail.
Network settings in kmail
Network -> Mail Sending set SMTP, 25th port, server name -
the name of your mailer,
I have - den.dhsilabs.com

Then add an account for POP3
Logs - den
Password - the password that is used to log in to the system
Server - den.dhsilabs.com
Port - 110

You should get the message you entered after data.