使用sendmail 指定发件人,发送邮件

sendmail -f 可以指定发件人的邮箱, -t 可以指定收件人的邮箱。这里先把一封邮件准备好,名字是 a.txt。

# a.txt

From: TEST <test@youxiangmi.com>
To: senlin <youxiangmi.com@qq.com>
MIME-Version: 1.0
Content-type: text/html
Subject: mail test

Test Content

sendmail指定发件人地址

cat a.txt | sendmail -f test@youxiangmi.com -t youxiangmi.com@qq.com
使用sendmail 指定发件人
#!/bin/bash

cat << EOF  | sendmail -f test@youxaingmi.com -t youxiangmi.com@qq.com
From: TEST <test@youxaingmi.com>
To: yxm <youxiangmi.com@qq.com>
MIME-Version: 1.0
Content-type: text/html
Subject: hello

this is mail
EOF

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注