前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >linux 安装配置 postfix+p

linux 安装配置 postfix+p

作者头像
py3study
发布2020-01-06 19:31:10
1.7K0
发布2020-01-06 19:31:10
举报
文章被收录于专栏:python3python3

            首先介绍下环境与提前准备。

            postfix      192.168.6.121

1.在自己的域名服务商添加 域名 与A记录,我的是内部测试也就在自己的内部DNS 上添加了 以下记录

                    IN      MX       10  mail.ludy.com  

mail             IN      A            192.168.6.121

2. 安装软件  postfix   dovecot-pop3d    sasl2  因为我是ubuntu 我就懒点,编译安装就不多说了。

shell $>     apt-get install sasl2-bin postfix dovecot-pop3d

3.修改 saslauthd 配置文件

shell $> vim /etc/default/saslauthd

START=yes

DESC="SASL Authentication Daemon"

NAME="saslauthd"

MECHANISMS="shadow"

MECH_OPTIONS=""

THREADS=5

OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd"

4.重启 saslauthd 服务

shell $> /etc/init.d/saslauthd restart

ln -s /var/spool/postfix/var/run/saslauthd/ /var/run/saslauthd

## 不做这步操作,验证总是报错.

shell $> adduser postfix sasl

shell $> testsaslauthd -u root -p 123

0: OK "Success."

5. 配置  dovecot pop3服务

shell $> vim /etc/dovecot/dovecot.conf

protocols = pop3 pop3s

log_timestamp = "%Y-%m-%d %H:%M:%S "

disable_plaintext_auth = no

mail_privileged_group = mail

protocol imap {

}

protocol pop3 {

       pop3_uidl_format = %08Xu%08Xv

}

protocol managesieve {

       sieve=~/.dovecot.sieve

       sieve_storage=~/sieve

}

auth default {

  mechanisms = plain login

  passdb pam {

  }

  userdb passwd {

  }

 user = root

 socket listen {

    client {

path = /var/spool/postfix/private/auth-client

      mode = 0660

        user = postfix

        group = postfix

    }

  }

}

dict {

}

plugin {

}

6.重启 dovecot 服务

shell $> /etc/init.d/dovecot restart

7.测试 dovecot pop 服务

shell $> telnet localhost 110

Trying ::1... Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. +OK Dovecot ready. user yang1 +OK pass ypmwbg +OK Logged in. quit +OK Logging out. quit

### logging 成功

8.配置 postfix 服务

shell $> vim /etc/postfix/main.cf

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)

biff = no

append_dot_mydomain = no

readme_directory = no

smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem

smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key

smtpd_use_tls=yes

smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache

smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

myhostname = mail.ludy.com

mydomain = ludy.com

myorigin = $mydomain

alias_maps = hash:/etc/aliases

alias_database = hash:/etc/aliases

myorigin = /etc/mailname

mydestination = ludy.com, mail.ludy.com, localhost.ludy.com, , localhost

relayhost =

mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

mailbox_size_limit = 0

recipient_delimiter = +

inet_interfaces = all

smtpd_sasl_type = dovecot

smtpd_sasl_path = private/auth-client

smtpd_sasl_auth_enable = yes

smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination

修改 master.cf

shell $> vim master.cf

smtp      inet  n       -       -       -       -       smtpd

替换为

smtp      inet  n       -       n       -       -       smtpd

9.重启 postfix 服务

/etc/init.d/postfix restart

10.测试 postfix 服务smtp

shell $> telnet localhost 25

Trying ::1...

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

220 mail.ludy.com ESMTP Postfix (Ubuntu)

ehlo mail.ludy.com

250-mail.ludy.com

250-PIPELINING

250-SIZE 10240000

250-VRFY

250-ETRN

250-STARTTLS

250-AUTH PLAIN LOGIN

250-ENHANCEDSTATUSCODES

250-8BITMIME

250 DSN

quit

11.添加用户

shell $> adduser  yang1           

shell $> adduser  yang2

##密码大家自己记得啊。

12. windows outlook express 测试

    a.打开 outlook 帐户选项

   b.点击添加,选邮件后出现显示名字.填写自己的名字,以便对方知道你是谁:

c.电子邮件地址,写我们postfix 配置的。

d.设置 pop3 服务器,由于我们都安装在了一台机器上,都是一个mail.ludy.com

e.填写用户名密码

   f.点下一步,点完成.双击败 mail.ludy.com

然后,

点确定. 然后在添加 yang2 这个用户,以便我们发收信建做测试.

f.创建邮件,yang1 发给 yang2 看是否正常:

g.点发送/接受按妞,收下邮件看 yang2是否收到!

好了,收到了,就先写这么多,如果有什么疑问,欢迎来信讨论.

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019-09-22 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
SSL 证书
腾讯云 SSL 证书(SSL Certificates)为您提供 SSL 证书的申请、管理、部署等服务,为您提供一站式 HTTPS 解决方案。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档