1. The centos, sasl2 package, and Sendmail package are installed by default; 2. Disable SELinux; otherwise, saslauthd will be affected by shadow authentication;
VI/etc/SELinux/config
Change SELinux = enforce to SELinux = disabled and restart the computer to take effect;
3. Modify the saslauthd configuration file and select the shadow authentication method;
VI/etc/sysconfig/saslauthd
Change mech = Pam to Mech = shadow;
4. Start saslauthd and verify if it works properly;
Service saslauthd start # Start saslauthd
Chkconfig saslauthd on # Set saslauthd to automatically start upon startup
Testsaslauthd-u username-P Password
If 0: OK "success." is displayed, saslauthd works normally;
5. Install sendmail-cf to configure the sendmail configuration file;
Yum install sendmail-cf
6. configure Sendmail. conf
VI/etc/mail/sendmail. MC
Delete the DNL starting with the following two rows:
Trust_auth_mech ('external DIGEST-MD5 CRAM-MD5 login plain ') DNL
Define ('confauth _ mechanisms ', 'external gssapi DIGEST-MD5 CRAM-MD5 login plain') DNL
# Configure the supported authentication methods. Users who pass verification after configuration can send emails without configuring relay in access.
Daemon_options ('port = SMTP, ADDR = 0.0.0.0, name = MTA ') DNL # modify the listening range
Daemon_options ('port = 587, name = MSA, M = A') DNL # add mail via port 587
M4/etc/mail/sendmail. MC>/etc/mail/sendmail. cf # generate the configuration
7. Add the domain name for Sendmail to receive emails;
VI/etc/mail/Local-host-names
Add a domain name such as an. Test // one line for each domain name
8. restart Sendmail and verify that Sendmail can be used properly;
Service Sendmail restart
Chkconfig Sendmail on
Telnet smtp_server 25
Helo domainname
250 domainname Hello [10.57.28.221], pleased to meet you
AUTH LOGIN
# Enter the username and password encoded in base64 and generate the following statement:
Perl-mmime: base64-e 'print encode_base64 ("word ")'
334 vxnlcm5hbwu6
Dgvzda ==# base64 encoded Test
334 ugfzc3dvcmq6
Ywjjzc4xmjm0 # base64 encoded abcd.1234
235 2.0.0 OK authenticated
Mail from: test@an.test
250 2.1.0 test@an.test... Sender OK
Rcpt to: test@an.test
250 2.1.5 test@an.test... Recipient OK
Data # Start email content
Subject: Test # mail title
This a test email. # Body of the email
. # End the email with one.
9. Install Dovecot to support pop3;
Yum install Dovecot
10. Configure Dovecot. conf
VI/etc/Dovecot. conf
Remove the # at the front of the following lines and modify them;
Protocols = IMAP POP3
Disable_plaintext_auth = No
Mail_location = mbox:/var/mail: inbox =/var/mail/% u
11. Start Dovecot;
Service Dovecot start
Chkconfig Dovecot on
12. Verify that POP3 can be used normally;
Telnet pop3_server 110
Auth
User user_name
Pass user_password
# After verifying OK, you can use POP3 to send and receive emails;