嵌入式arm 邮件功能搭建-ssmtp+mailx

博客介绍了资源ssmtp_2.64.orig.tar.bz2与mailx-12.4.tar.bz2的编译过程,包括解压、配置和编译指令。还说明了部署步骤,如拷贝文件、建立软连接等。最后给出了测试指令,可用于发送带附件的邮件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

参考:https://blog.youkuaiyun.com/farsight2009/article/details/5545156

资源ssmtp_2.64.orig.tar.bz2与mailx-12.4.tar.bz2

 ssmtp_2.64.orig.tar.bz2

解压后配置,make;make install 可以得到ssmtp,及/etc/ssmtp/下revaliases  ssmtp.conf两个文件

CC=arm-hisiv400-linux-gcc;./configure --host=arm-hisiv400-linux --prefix=../build--sysconfdir=/etc --no-recursion --enable-ssl

sed -i "s/$(INSTALL) -s -m/$(INSTALL) -m/g" ./Makefile  #安装时install -s指令屏蔽,可以不理会,

--enable-ssl,我暂时没有添加这个选项,仅能使用smtp协议的25端口号。

 

mailx-12.4.tar.bz2

解压后进入路径,使用如下指令编译

CC=arm-hisiv400-linux-gcc make

 

部署

1.拷贝ssmtp 到板子的/usr/sbin/目录

2.在/usr/lib/路径下建立sendmail 指向ssmtp的软连接   路径不能错

     ln -s /usr/sbin/ssmtp /usr/lib/sendmail

3.拷贝mailx到/usr/sbin下

4.在/usr/sbin下建立mail到mailx的软连接

  ln -s /usr/sbin/mailx /usr/sbin/mail

5.拷贝编编译ssmtp生成的配置目录到板子的/etc/ssmtp的目录下保证/etc/ssmtp目录下有如下两个文件

  revaliases  ssmtp.conf

6.修改/etc/ssmtp/配置文件

revaliases文件添加最后一行

# sSMTP aliases
# 
# Format:       local_account:outgoing_address:mailhub
#
# Example: root:your_login@your.domain:mailhub.your.domain[:port]
# where [:port] is an optional port number that defaults to 25.
root:xxx@xxx.com.cn:smtp.xxx.com.cn:25

 

ssmtp.conf

#
# /etc/ssmtp.conf -- a config file for sSMTP sendmail.
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=yourmailaddr@xxx.com.cn
# The place where the mail goes. The actual machine name is required
# no MX records are consulted. Commonly mailhosts are named mail.domain.com
# The example will fit if you are in domain.com and you mailhub is so named.
mailhub=smtp.xxx.com.cn:25
# Where will the mail seem to come from?
#rewriteDomain=xxx
# The full hostname
hostname=xxx-System-Product-Namei

AuthUser=xxx@xxx.com.cn
AuthPass=xxxxxxxx

 

 

 

测试指令

echo "aaa" | mail -v -a ./xx.tar.gz -s "test" xxxxxx@yeah.net

echo是邮件内容,-v是显示邮件过程细节,-a后边是附件,-s是标题 ,最后的是目的邮箱

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值