busybox sendmail 例子

  1. 首先创建一个纯文本, 写入一下内容:

Subject: Restart due to high load

Restart due to high load on router

  1. 发送email的命令

cat var/test/routerRestartMail.txt | sendmail -S"smtp.163.com" -au"我的163邮箱用户名" -ap"163邮箱密码" -f"发送者邮箱名@163.com"

  1. sendmail 的详细说明文档:

root@home:/opt/var/eric# sendmail
BusyBox v1.18.4 (2013-05-26 18:44:50 CST) multi-call binary.

Usage: sendmail [OPTIONS] [RECIPIENT_EMAIL]...

Read email from stdin and send it

Standard options:
-t Read additional recipients from message body
-f sender Sender (required)
-o options Various options. -oi implied, others are ignored
-i -oi synonym. implied and ignored

Busybox specific options:
-w seconds Network timeout
-H 'PROG ARGS' Run connection helper
-H 'exec openssl s_client -quiet -tls1 -starttls smtp
-connect smtp.gmail.com:25' <email.txt
[4<username_and_passwd.txt | -au -ap]
-H 'exec openssl s_client -quiet -tls1
-connect smtp.gmail.com:465' <email.txt
[4<username_and_passwd.txt | -au -ap]
-S server[:port] Server
-au Username for AUTH LOGIN
-ap Password for AUTH LOGIN
-am Authentication method. Ignored. LOGIN is implied

Other options are silently ignored; -oi -t is implied

标签: none