标签: mailx

使用mailx发送html

我想使用mailx从主机发送一个html文件,但不是将其解释为html而是将其作为文本(html代码)发送出去。有没有办法将它作为html发送?

(cat <<EOCAT
Subject: TEST email
MIME-Version: 1.0
Content-Type: text/html
Content-Disposition: inline
EOCAT
header
cat $MSGFILE
footer
) | mailx -r localhost@host.com myemail@website.com
Run Code Online (Sandbox Code Playgroud)

bash email html mailx

3
推荐指数
1
解决办法
1万
查看次数

Uuencode 在电子邮件正文中显示文件内容,而不是在附件中附加文件

我想在电子邮件中以附件形式发送一个简单的文本文件。发送电子邮件时,附件丢失,而是在电子邮件正文中显示附件的内容。需要建议修复它请。

这是我的输入:

bash-4.1$ cat test.txt  
HelloWorld !  

bash-4.1$ uuencode test.txt test_attachment.txt|mailx -s 'testing' mail@mail.com  
Run Code Online (Sandbox Code Playgroud)

这是电子邮件上的输出:

begin 664 test_attachment.txt
/2&5L;&]7;W)L9"`A(`H*
`
end
Run Code Online (Sandbox Code Playgroud)

command-line email mailx

2
推荐指数
1
解决办法
2万
查看次数

MailX 作为 Systemd 服务运行时不发送电子邮件

我有一个 shell 脚本,它对我的​​ arch linux 系统上的一个文件夹运行 clamav 扫描,并应该通过电子邮件发送结果。这是代码:

\n\n
/usr/bin/clamscan -r -i /path/to/folder | /usr/bin/mailx -A gmail -s "Clam Scan Results $(/usr/bin/date +%F)" address@gmail.com\n
Run Code Online (Sandbox Code Playgroud)\n\n

如果在 bash 命令行上运行,上面的一行代码可以正常工作,并且我确认在/etc/mailrc工作中配置的帐户并收到了电子邮件。但我希望它按计划运行,我设置了一个 systemd 服务单元来调用名为 ~/bin/virusscan.sh 的脚本,并设置了一个 systemd 计时器单元以在每晚凌晨 2 点触发它。管道之后的 mailx 部分始终在报告... email not sent

\n\n

SystemD 执行脚本的方式有显着差异吗?

\n\n

/usr/lib/systemd/system/virusscan.service

\n\n
[Unit]\nDescription=Daily virus scan\n\n[Service]\nType=simple\nExecStart=/home/username/bin/virusscan.sh\n\n[Install]\nWantedBy=multi-user.target\n
Run Code Online (Sandbox Code Playgroud)\n\n

/usr/lib/systemd/system/virusscan.timer

\n\n
[Unit]\nDescription=Execute virus scan daily at 2 AM\n\n[Timer]\nOnCalendar=*-*-* 02:00:00\nUnit=virusscan.service\n\n[Install]\nWantedBy=multi-user.target\n
Run Code Online (Sandbox Code Playgroud)\n\n

然后我可以立即运行该服务来测试:

\n\n
sudo systemctl start virusscan \n
Run Code Online (Sandbox Code Playgroud)\n\n

服务运行时的状态如下:

\n\n
virusscan.service - Daily virus scan\n …
Run Code Online (Sandbox Code Playgroud)

email systemd mailx

2
推荐指数
1
解决办法
2750
查看次数

为什么使用“mailx”时“EOT”不结束邮件正文并发送邮件?

这是我尝试过的:

$ mailx -s "test email" cloud
Cc: 
"again and agina"
.
EOT
Run Code Online (Sandbox Code Playgroud)

或者,

$ mailx -s "test email" cloud
Cc: 
"this is the first email"
<< EOT
Run Code Online (Sandbox Code Playgroud)

但按下后Enter什么反应也没有。为什么?

mailx

0
推荐指数
1
解决办法
1044
查看次数

标签 统计

mailx ×4

email ×3

bash ×1

command-line ×1

html ×1

systemd ×1