installing and configuring Sendmail in Ubuntu

 Installing and configuring Sendmail in Ubuntu environment. Configuring Sendmail Problems with Intertelecom

It appeared back in 1983, but is actively used to this day. Among key features - support by many platforms that exist today, as well as free. The app comes with open source code. This means that everyone can add their own functionality to it, or change it at will. IN operating system Ubuntu, Sendmail, which is configured using the Linux command line, has caught on 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.

Sendmail 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 into the box email... 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 the server local network to the Internet server and the 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, 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 are available 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 (Apache, MySQL, MRTG, etc.) is located.

Book:

If you are using a RedHat compatible distribution, you will need to install the appropriate packages. I am using sendmaiI-8.11.0 and imap-4.7c2. Latest version 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 isn't 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 /etc/sendmail.cf. 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 not_exists@A.com another non-existent user not_exists@B.com. The letter is sent through hostcom, which allows the message to be redirected ("Accept email for domain.com" mode is not enabled). The mail server of the B.com domain sends a message to the address not_exists@A.com that the user not_exists@B.com does not exist. In turn, the mailer of the A.com domain informs that the user not_exists@A.com also does not exist and sends a message to the address not_exists@B.com. 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".

Figure: 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 - which are denied. 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 the address 192.168.1.0 and the mask 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 <name_only_created_mailer> 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 correctly it does it. To do this, enter something like the following:


mail from: me@my.host.com

220 2.1.0 me@my.host.com …. Sender Ok

rcpt to: den@den.dhsilabs.com

220 2.1.5 den@den.dhsilabs.com …. 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 den@den.dhsilabs.com - 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 den@den.dhsilabs.com and dhsilabs.com are given as examples. You must provide your values \u200b\u200binstead.

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 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 is the name of your mailer, in this example it is den.dhsilabs.com. Then add an account for POP3:

Username - den

Password - the password 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 when 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, do not forget 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 the sendmail program is very easy using the configurator, but sometimes basic configuration is not enough. For more precise configuration, you need to look at the sendmail configuration files.

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 the 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 don't 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 file that is two kilobytes in size, and quite another if 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\u003e /etc/sendmail.cf

Before running this command, I highly recommend that you save your 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.

This file is usually called sendmail.mc. It can sometimes be called differently, such as redhat.mc, if you are using the Red Hat operating system or a compatible one.

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\u003e /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 \u003d smtp, Addr \u003d 127.0.0.1, Name \u003d MTA")
  • dnl NOTE: binding both IPv4 and IPv6 daemon to the same port requires
  • dnl a kernel patch
  • dnl DAEMON_OPTIONS (xport \u003d smtp, Addr \u003d :: 1, Name \u003d MTA-v6, Family \u003d 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 functionality sendmail programs by adding the functions you want to the mc file.

Let's assume that 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\u003e /etc/sendmail.me

That's all! The node names will be hidden. Other functions are described in table. 13.1.

Sendmail Functions Table 13.1

FunctionDescription
access_dbDefines 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_domainsAllows sending mail to domains that cannot be recognized
bestmx_is-localMessages will be accepted only if the MX DNS record points to this mail server
blacklist_recipients"Black list". Another option for fighting spam. For its operation, the access_db option is required
dnsblUsed to work with the black list, dnsbl is an abbreviation for DNS Black List. In earlier versions, this option was called (Resolve Black List)
domaintableUsed to resolve domain names
genericstableUsed to change the sending address in messages
local_procmailIndicates that mail should be delivered using the local procmail utility
mailertableOverrides routing for specific domains
masquerade_entire_domainUsed to mask (hide) the entire domain. This function must be used together with the MASQUERADE AS (or MASQUERADE_DOMAIN) directive, for example, MASQUERADE_AS (f117.ru) dnl
masquerade_envelopeAllows to hide domain host names. Replaces the received from field of the message header before transmitting the message to others
redirectUsed 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_MXAllows mail forwarding (relaying) only for hosts specified in MX DNS server records
relay_hosts_onlyAllows relaying only for nodes specified in access_db
relay_mail_fromAllows relaying only if the sender is listed in the RELAY list of accessdb
smrshUsing the limited sendmail shell
use_cf_fileWhen this function is specified, sendmail will look in the sendmail.cf file for a list of trusted users
use_cw_fileWhen specified, sendmail will look in the sendmail.cw file for a list of local hosts
virtusertableConverts the recipient's address to the address of a local user

The /etc/mail/sendmail.cw file lists all the aliases for this mail server. Let's assume your server name is mail.dhsilabs.ru. If the sender sends mail to the address den@mail.dhsilabs.ru, the letter will be delivered to user den without any problems. And if someone sends a letter to the address den@dhsilabs.ru, 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, put a line in the sendmail.cw file.

You hardly need web serverthat 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 IP address.

Editing the file / etc / hostsso 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 a 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 execute:

/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. The 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: no-reply@gmail.com it gives us: 250 2.1.0 no-reply@gmail.com... Sender ok, enter: RCPT TO: my_exist@gmail.com it gives us: 250 2.1.5 my_exist@gmail.com... Recipient ok, 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 ( my_exist@gmail.com) a message ("test message") should come.

Php.ini setup

gedit /etc/php5/apache2/php.ini

Find and edit the next line

sendmail_path \u003d / usr / sbin / sendmail -t -i

Checking the mail () function

echo mail (" my_exist@gmail.com"," test message "," test message "," From: no-reply@gmail.com"); ?>

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 email - 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.

Training

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 -\u003e / etc / alternatives / sendmail

Installation

sudo apt-get install sendmail sasl2-bin

Setting / 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@gmail.com"" I: email@gmail.com"" P: YourPass "" M: PLAIN "AuthInfo: smtp.gmail.com: 465" U: email@gmail.com"" I: email@gmail.com"" 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@gmail.com"" I: email@gmail.com"" 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\u003e 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 black lists. You can check your 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 set up 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 the /etc/php5/apache2/php.ini config (/etc/php5/cli/php.ini):

## Configuring sendmail for PHP: sendmail_path \u003d / usr / sbin / sendmail -t; sendmail_path \u003d "/ usr / sbin / sendmail -t -f phpweb7@gmail.com -i "

Check the settings

echo "Message text" | mail -s "Subjet" youremail@gmail.com sendmail -t to_receiver@gmail.com -f from@gmail.com -v -i< ~/mail-body.txt

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

Sendmail management

View the entire message queue:

Sudo mailq

View the message queue at a specific address:

Sudo mailq | grep " email@gmail.com"| 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@gmail.com"" () "\u003e / 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 “ Command line Linux 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 linux version, you need to install the appropriate packages.
I use
sendmail-8.11.0
imap-4.7c2

Before you start configuring sendmail, you need to set up 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.
There is netconf utility 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

Choose from the menu Mail delivery systemthen 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
settings are stored) :)

Now let's make it so that sendmail only accepts mail from authorized
addresses. You don't even need to configure sendmail itself for this - you only need
edit files /etc/hosts.allow and /etc/hosts.deny
The first one contains a list of hosts that are allowed to access this
car, and in the second it is prohibited. Please note: despite the name
(allowed | forbidden), 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 > $@ OK
R< $+ @ $=R > $@ OK

# anything originating locally is ok
R $ * $: $ (dequote "" $ & (client_name) $)
R $ \u003d w $@ OK
R $ \u003d R $@ OK
R$@ $@ 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: me@my.host.com
220 2.1.0 me@my.host.com .... Sender Ok
rcpt to: den@den.dhsilabs.com
220 2.1.5 den@den.dhsilabs.com .... 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)

den@den.dhsilabs.com -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 -\u003e Mail Sending set SMTP, port 25, server name -
the name of your mailer,
i have - den.dhsilabs.com

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

You should get the message you entered after data.




Post a Comment

0 Comments