Sendmail set the local SMTP server to send mail to the client

Source: Internet
Author: User
Tags dovecot

Recently encountered a problem, that is, there is an IDC room server does not allow the connection of the external network, where the set of services to run using Zabbix monitoring, which causes the Zabbix server can not send alarm messages, the solution to this problem is much more natural, but for one reason or another, I have used the following method to solve. Find a machine that can connect to an external network, build an SMTP service on this machine, and then connect the Zabbix server on the IDC room to the STMP server to send mail. Here are the steps to proceed:


Mail server configuration:

1, the system environment: CentOS 6.5 x86_64.

2. Software Environment:
mail system software: sendmail-8.14.4-9.el6.x86_64, Sendmail-cf-8.14.4-9.el6.noarch, m4-1.4.13-5.el6.x86_64

SMTP authentication: cyrus-sasl-2.1.23-15.el6_6.2.x86_64, cyrus-sasl-md5-2.1.23-15.el6_6.2.x86_64, cyrus-sasl-plain-2.1.23-15.el6_6.2.x86_64, cyrus-sasl-lib-2.1.23-15.el6_6.2.x86_64

Pop authentication (optional): dovecot.x86_64 1:2.0.9-22.el6

The installation of the software can be installed using Yum (recommended), or a corresponding package can be found for installation.

3. Environment configuration:

3.1, POP3 certification configuration

Since POP3 authentication is using Dovecot, the default profile is/etc/dovecot/dovecot.conf no need to change any settings.

( Online said to modify the/etc/dovecot.conf file, the 17th line of: #protocols = IMAP imaps POP3 pop3s # removed. In fact, it has enabled these services by default, unless you only want to use Dovecot-auth authentication, you can change to Protocols = none, otherwise do not change. )

3.2. SMTP authentication settings

Open config file/etc/sysconfig/saslauthd, locate mech=pam Modify to Mech=shadow and save! (The purpose of this is to use the user of the operating system to do the verification, of course, without modification will use the own authentication service)


3.2. SendMail setting

3.2.1, configuring the Mail server name

Open the configuration file/etc/mail/local-host-names, add a line at the bottom, that is, the domain name of the mailbox, such as my balich.com here, and then save

In addition, if necessary, you need to add Exchange records for messages on the DNS server.


3.2.2, Configuration SENDMAIL.MC

Open configuration file/etc/mail/sendmail.mc,

Found it:

DNL Trust_auth_mech (' EXTERNAL digest-md5 cram-md5 LOGIN PLAIN ') dnl

DNL define (' confauth_mechanisms ', ' EXTERNAL GSSAPI digest-md5 cram-md5 LOGIN PLAIN ') dnl

Remove the previous DNL, in the SendMail configuration file, Dnl represents a comment, modified as follows:

Trust_auth_mech (' EXTERNAL digest-md5 cram-md5 LOGIN PLAIN ') dnl

Define (' confauth_mechanisms ', ' EXTERNAL GSSAPI digest-md5 cram-md5 LOGIN PLAIN ') dnl


Found it:

dnl daemon_options (' port=smtp,addr=127.0.0.1, Name=mta ') dnl

Remove the previous DNL and modify it as follows:

daemon_options (' port=smtp,addr=0.0.0.0, Name=mta ') dnl


At this point, the SENDMAIL.MC configuration file modification is complete, save the file exit.

To generate the SENDMAIL.CF file using the M4 command, proceed as follows:

M4/ETC/MAIL/SENDMAIL.MC >/ETC/MAIL/SENDMAIL.CF

Finally, the server-side configuration is completed by starting the appropriate service:

Start the Dovecot process (if necessary):

/etc/init.d/dovecot start

To start the SASLAUTHD process:

/ETC/INIT.D/SASLAUTHD start


To start the SendMail process:

/etc/init.d/sendmail Star


Mail Client configuration:

Under the Linux system, there is a mail command to send mail, here you need to modify the following configuration:

Open configuration file:/etc/mail.rc

Add the following information:

Set [email protected]com

Set smtp=.balich.com

Set Smtp-auth-user=balich

Set SMTP-AUTH-PASSWORD=BALICHPW

Set Smtp-auth=login

The account number here corresponds to the user name and password on the SendMail server, and all configurations are complete. You can already send mail as expected.


This article is from the "Balich" blog, make sure to keep this source http://balich.blog.51cto.com/6641781/1794544

Sendmail set the local SMTP server to send mail to the client

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.