内部邮件服务器 hMailServer的搭建

 最近项目测试邮件功能比较频繁,而且邮件的数量非常的多,之前团队使用公司的邮件服务器作为测试服务器,导致公司的邮件系统崩了,现在在内网搭建一个邮件服务器来进行功能测试,软件选择hMailServer.

hMailServer的配置

https://www.cnblogs.com/tiger-fu/p/7448005.html

按照这个教程可以完成基础的配置,注意要发送邮件必须打开SMTP服务。

https://www.cnblogs.com/zhangming-blog/articles/5958649.html

我使用的是Outlook邮箱,根据上方的教程可以完成连接,注意服务器地址填安装的机子的IP地址。

只是简单发发邮件的话以上的配置就可以了,下面要注意SMTP的配置

内部邮件服务器 hMailServer的搭建

Local host name填入本机的地址,下面的SMTP Relayer简单使用的话不用设置,如果设置不对,填成和local host相同的话会出现错误,导致无法启用。

配置完成后使用自带的诊断工具进行测试

内部邮件服务器 hMailServer的搭建

红圈中不出现问题,就基本能作为发送邮件的服务器了。

项目中使用

 在项目中的POM中使用以下配置连接,重点是标红的地方

<profile>
    <id>保密</id>
    <properties>
        <sqlserver.url>
            保密
        </sqlserver.url>
        <sqlserver.username> 保密</sqlserver.username>
        <sqlserver.password> 保密</sqlserver.password>
        <sqlserver.driver.class>com.microsoft.sqlserver.jdbc.SQLServerDriver</sqlserver.driver.class>
        <redis.host>localhost</redis.host>
        <redis.port>6379</redis.port>
        <redis.password></redis.password>
        <redis.database>15</redis.database>
        <email.protocol>smtp</email.protocol>
        <mail.host>hmailServer主机的地址</mail.host>
        <mail.username>hmailServer中的ACCOUNT账户</mail.username>
        <mail.password>hmailServer中的ACCOUNT密码</mail.password>
        <mail.default.encoding>UTF-8</mail.default.encoding>
        <mail.protocol>smtp</mail.protocol>
        <mail.auth>true</mail.auth>
        <mail.ssl.enable>true</mail.ssl.enable>
        <mail.debug>true</mail.debug>
        <mail.bcc> 保密</mail.bcc>
        <email.exchange.url>exchange_url</email.exchange.url>
        <email.account>username</email.account>
        <email.password>password</email.password>
        <email.enableSend>true</email.enableSend>
        <host.domain> 保密</host.domain>
        <image.root.path></image.root.path>
        <help.userGuide> 保密</help.userGuide>
        <ocr.service> 保密</ocr.service>
        <es.service> 保密</es.service>
    </properties>
</profile>