Setting up Sendmail. Basic installation and configuration of Sendmail on Ubuntu Server Problems and solutions


Installation and configuration guide for one of the oldest MTA (Mail Transfer Agent), program for sending email - sendmail, which is available for installation on any operating system. In 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 is taking a long time, install postfix (), you shouldn’t 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 It takes a long time to start and sends mail slowly. Possibly host localhost.localdomain Can be missed, not sure.

After this, you need to specify the names of the 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 on 587 (if you have problems with authorization):

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

Chmod 600 /etc/mail/auth/*

Config sendmail.mc

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

Applying 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 end up in a “deferred queue” and are not relayed to another SMTP:

  1. Check your IP in the blacklists. You can check the IP ban here smart-ip.net, my IP was included in the spamhaus database.
  2. Check if your provider is blocking outgoing packets on port 25.
Problems with Intertelecom!

I was never able to set up a message relay to GMail via sendmail on the Intertelecom connection - sendmail stubbornly knocked on port 25, which was closed by the provider. I had to configure postfix.

PHP setup (if necessary)

Specify sendmail launch parameters in the config /etc/php5/apache2/php.ini (/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 several messages from the console. I 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 by 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 Denis Kolisnichenko’s latest book “ 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. 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, let's install the necessary software. We will 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 do some basic setup of sendmail. To do this you need to run the utility
netconf. It works both from X and from the console.
The netconf utility is available 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 menu Mail delivery system, then Basic sendmail configuration
In the Present your system as field, simply 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 quite enough for your sendmail to function.
You can set additional sendmail program options using
netconf. If you don't have sendmail, you'll get an unforgettable
the pleasure of manually editing the /etc/sendmail.cf file - in it
settings are stored) :)

Now let's make sendmail accept mail only from authorized
addresses. To do this, you don’t even need to configure sendmail itself - you only need
edit files /etc/hosts.allow and /etc/hosts.deny
The first of them contains a list of hosts that are allowed access to this
car, and in the second - 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
network add the line to the /etc/hosts.allow file
"192.168.1.
This means 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 /etc/hosts.allow

In order to accept 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$=w $@ OK
R$=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 on each line.
Only these domains will allow the mailer to receive mail - everyone else will receive
message 550 Relaying Denied

Now it's POP3's turn. After installing the imap package you have almost
everything is set up, i.e. I want to say that you can already 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, all that remains is to check how correctly it is :)

Enter
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 enter data, then the text of the message, to end the entry we put a dot
on an empty line

Sendmail will report that the message has been sent (more precisely, placed in
queue for departure)

[email protected]-name of the user to whom I send mail.
den.dhsilabs.com - the name of my mailer
Please note that the node my.host.com does not exist in nature, but Sender Ok.
That's why it's better to enable the Wait for DNS option in the sendmail settings

Now you need to launch some email client for example kmail
and pick up the mail.
Network settings in kmail
Network -> Mail sending set SMTP, port 25, server name -
your mailer's name,
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 receive the message you entered after data.

The book discusses in detail the settings of network services that allow you to create a server with the required configuration and functionality based on the Linux OS. You can configure 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 of the material 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 room, setting up Dr. antiviruses. Web and AVP for Linux, traffic accounting program MRTG, security and attack detection system LIDS, 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 book of its commands is provided. After reading the book, you will become knowledgeable about configuring and compiling the kernel, creating your own rpm packages, the bash command interpreter, 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 installing the Linux OS, and the first chapter describes the basic network technologies and protocols (Young Administrator Course).

All listings given in the book have been tested in practice and are placed on the attached CD. In addition, it contains a lot of reference information (HOWTO, RFC), as well as articles on Linux. There is a rich set of auxiliary utilities and software for the server (Apache, MySQL, MRTG, etc.).

Book:

If you are using a RedHat compatible distribution, you will need to install the appropriate packages. I'm 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 setting up sendmail, you need to configure DNS correctly. Setting up a DNS server was discussed in detail in Chap. 10. If you are setting up only a mail server, you do not need to set up 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 begin setting up basic sendmail, run the netconf utility (see Figure 13.1). It works both from X-Window and from the console. The netconf utility is available in RedHat Linux, Mandrake, ASPLinux and other distributions; it is definitely not in KSI Linux. Naturally, you must be logged in as root. If you don't have netconf, you'll have a blast editing the /etc/sendmail.cf file by hand. It is in this file that 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, simply enter your domain name. Then be sure to check the “Accept email for your_domain.com” checkbox (see Figure 13.2). If you don't do this, messages may be redirected through your server to another server. At the same time, extra traffic will flow through your server, which is of no use to you. Once upon a time there was even this type of denial 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 you to redirect the message (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 A.com domain mailer reports that the user [email protected] also does not exist and sends a message to the address [email protected]. Indirect recursion occurs. Now imagine that there is not just one such message, but, say, 100 and the volume of each is at least 1 MB! As a result, one of the servers in the chain domain1.com - host.com - domain2.com should “fall”.


Rice. 13.2. Basic sendmail configuration

I apologize, I went a little off topic, let's continue configuring sendmail. Set the message sending protocol to smtp (Mail gateway protocol).

This information is already quite enough for your sendmail to function. You can set additional sendmail options using netconf.

Now make sendmail accept mail only from allowed addresses. To do this, you don’t even need to configure sendmail itself - you just need to edit 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 “denied”, 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.

This means 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 configured, i.e. I want to say that you can already check the configuration. Restart the inetd or xinetd daemon, depending on which one you are using, and enter the following:

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

You should see something like this in response:

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, all that remains is to check how correctly 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 message text, and to end the entry, put a period in the empty line. Sendmail will report that the message has been sent (more precisely, placed in the queue for sending). Record [email protected]- the name of the user to whom you are sending mail. The user must really exist. The entry den.dhsilabs.com is the name of your mailer.

Note. Names [email protected] and dhsilabs.com are given as an example. You must specify your values ​​instead.

Please note that the node my.host.com does not exist in nature, and the sendmail program reports that “Sender Ok”. That’s why it’s better to enable the Wait for DNS option in the sendmail settings.

Now you need to launch some email client, for example kmail, and receive mail. Use the following network settings in kmail: 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 used to log into the system.

Server - den.dhsilabs.com

As a result, you should receive the message that you entered after data. This may cause problems with name resolution. To avoid them, you need to correctly configure DNS or use its IP address instead of the mail server name. When adding a new user, be sure to set their login password. If you do not do this and try to receive mail without specifying a password, you will receive the message “Authentication failed.”

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

Note. In most cases, you will be satisfied with the basic setup until spammers take you under their “protectorate” - then you will need to read Chapter. 23 about anti-spam methods. However, one of Murphy's laws may come into play - a sendmail configurator will not be developed for your system and then you will 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. This file is said to be longer than Bill Gates' 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 see for yourself. Only professional administrators or sendmail program 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: the size of my mc file is 2459 bytes, and the size of the sendmail.cf file is 46302 bytes. It's one thing to edit a two-kilobyte file, but 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 > /etc/sendmail.cf

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

The default configuration file, which 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 sendmail, it may be located in the /usr/lib/sendmail directory.

Typically this file is called sendmail.mc. Sometimes it may be called something else, such as redhat.mc if you are using a Red Hat or compatible operating system.

An example of the standard file /usr/share/sendmail-cf/cf/redhat.mc 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

Using the FEATURE directive, you can enable one or another function of the sendmail program. For example, the mailertable function is designed to override routing for specific domains. You can easily expand the functionality of the sendmail program by adding the functions you need to the mc file.

Let's assume that you want the names of computers in a domain to be hidden. 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. A description of other functions is presented in table. 13.1.

Functions of the sendmail program Table 13.1

Function Description
access_db Defines the access table. This table lists the hosts that are allowed or blocked from sending 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 Chapter. 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 entry points to this mail server
blacklist_recipients "Black list". Another option to combat spam. The access_db option is required for it to work.
dnsbl Used for blacklisting, dnsbl is short 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 Specifies 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 domain hostnames. 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 message please try
(try using this address)
relay_based_on_MX Allows mail redirection (relay) only for hosts that are specified in the 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 the accessdb database
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 local user's address

The file /etc/mail/sendmail.cw lists all aliases for a given mail server. Let's assume that 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.

It's unlikely you need web server which cannot send mail from your site. Below is an easy way to quickly deploy sendmail as an MTA (Mail Transfer Agent) sending 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 clearly know what DNS FQDN name the host has and that it exists on the world wide web.

Let's assume that the server on which sendmail is working has an IP address 123.123.123.123

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

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

Sudo nano -w /etc/hosts

The second line that should be added is a description of the server’s 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 there the correct server name, which was entered in /etc/hosts in our example, this is your-web-server.

Contents of the /etc/hostname file after editing:

Your-web-server

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

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

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

I 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, 9 Dec 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] gives us: 250 2.1.0 [email protected]... Sender ok enter: RCPT TO: [email protected] gives us: 250 2.1.5 [email protected]... 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 email 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 ("test message") should arrive.

Setting up php.ini

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 it worked for you configure Sendmail on Ubuntu

It appeared back in 1983, but is still actively used to this day. Among the key features are that it is supported by many platforms that exist today and is also free. The application comes with open source software. This means that anyone can add their own functionality to it, or change it at will. In the Ubuntu operating system, Sendmail, which is configured using the Linux command line, has taken root due to good support and rich capabilities.

The message processor – Sendmail – has become widespread in the business sphere.

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 performance and good integration with all business processes. Sentrion offers, along with new technologies, the use of legacy applications that have taken root well. The app is also friendly enough to suit home users.

Program installation

You need to install Sandmail on 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 will need a LAMP component stack. It can be found in the repository.

IMPORTANT. Before installing new software, be sure to update the package lists in your local repository using the command

"$ sudo apt-get update"

The Sandmail installation begins with the command “sudo apt install sendmail”, which will download the mail agent packages.

"mcedit /etc/hosts"
"sudo sendmailconfig"

After this, 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 utilities for working with mail:

"sudo install mailutils"

We check the functionality of the entire system:

"mail your_mail< /dev/null»

where “your_mail” is the current postal address.

And 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"

All that remains is to go to your email inbox. It should already contain a test message.

So, you've learned more about a program for Ubuntu called Sendmail, which turned out to be not that difficult to set up. If you have questions about other aspects of working with programs for Linux, look for answers to them on the pages of our website!







2024 gtavrl.ru.