​​友链​​

微信搜索我吃你家米了关注公众号

使用postfix和roundcube搭建webemail_解决方案

​​

其中有一个地方有问题,就是在​​/etc/postfix/main.cf​​​配置文件的​​mynetworks​​的配置需要注意

官方文档中对该参数值的描述:

​ http://www.postfix.org/postconf.5.html​

The list of "trusted" remote SMTP clients that have more privileges than "strangers".

In particular, "trusted" SMTP clients are allowed to relay mail through Postfix. See the smtpd_relay_restrictions parameter description in the postconf(5) manual.

You can specify the list of "trusted" network addresses by hand or you can let Postfix do it for you (which is the default). See the description of the mynetworks_style parameter for more information.

If you specify the mynetworks list by hand, Postfix ignores the mynetworks_style setting.

Specify a list of network addresses or network/netmask patterns, separated by commas and/or whitespace. Continue long lines by starting the next line with whitespace.

The netmask specifies the number of bits in the network part of a host address. You can also specify "/file/name" or "type:table" patterns. A "/file/name" pattern is replaced by its contents; a "type:table" lookup table is matched when a table entry matches a lookup string (the lookup result is ignored).

The list is matched left to right, and the search stops on the first match. Specify "!pattern" to exclude an address or network block from the list. The form "!/file/name" is supported only in Postfix version 2.4 and later.

Note 1: Pattern matching of domain names is controlled by the or absence of "mynetworks" in the parent_domain_matches_subdomains parameter value.

Note 2: IP version 6 address information must be specified inside [] in the mynetworks value, and in files specified with "/file/name". IP version 6 addresses contain the ":" character, and would otherwise be confused with a "type:table" pattern.

Examples:

mynetworks = 127.0.0.0/8 168.100.189.0/28
mynetworks = !192.168.0.1, 192.168.0.0/28
mynetworks = 127.0.0.0/8 168.100.189.0/28 [::1]/128 [2001:240:587::]/64
mynetworks = $config_directory/mynetworks
mynetworks = hash:/etc/postfix/network_table

大致意思就是匹配到mynetworks配置的网络段的客户端IP可以将其邮件发给我们的25端口进行邮件的转发,我们配置webmail,只需要将其设置为127.0.0.0/8,也就是本地环回地址即可

还有一个地方就是第一篇文章,没有创建存放用户邮件的目录

mkdir -p /var/mailbox
chown -R postfix /var/mailbox

按照第一篇文章操作完成后,我们可以使用telnet对我们的邮件服务器进行测试

使用postfix和roundcube搭建webemail_解决方案_02

现在我们的smtp服务器已经配置成功了,可以正常发信了

以上配置过程中更改之后的所有配置文件:​​https://gitee.com/wochinijiamile/suiyi/raw/master/123.tar.gz​

下面我们进行smtp用户认证的配置

在编译安装courier-authlib会遇到如下错误:

​configure: error: Unable to find ltdl.h. Please install Libtool's ltdl library​

解决方案:

​yum install libtool-ltdl-devel​

然后我们还会遇到下面这个错误

​configure: error: --with-authmysql specified but no mysqlclient.so​

这时我们需要安装mysql-server

​参考文章​

​备份连接​

安装完成之后还是会报上面那个错误,我们的解决方案就是,先使用​​ldconfig -v | grep mysql​​找到mysql的库文件的位置

然后在编译安装的configure中进行一下更改