html - How to stop mails from going to /var/spool/mail/$USER folder and redirect them to the personal mail
问题描述
I've written a script which sends an HTML
file through the mail using mailx
.
My code is:
mail_id=demo@host.com
cat /home/oretail/tmp/main.html | mailx -s "$(echo 'Subject Content-Type: text/html')" $mail_id
The mail is going to /var/spool/mail/root
folder.it's not coming to the specified e-mail id.
How to do i this?
mail_id=demo@host.com
cat /home/oretail/tmp/main.html | mailx -s "$(echo 'Subject Content-Type: text/html')" $mail_id
解决方案
mailx does not deliver e-mail to the recipient, it is user agent. It puts a message to the queue to local MTA (Mail Transfer Agent) which can be sendmail, postfix, nullmailer,... or to remote SMTP server using following option
-S smtp=smtp://your_smtp_server.com
Messages in /var/spool/mail/root are most probably notifications about non delivered messages.
推荐阅读
- java - 如何在 Java 的 for 循环中获取不同数据类型的多个用户输入?
- python - 使用 pandas 的绘图方法在 1 行中绘制图形的问题
- c# - MenuFlyoutItem 点击事件的问题,但只有“有时”
- javascript - 如何像文本栏动画一样移动画布内的文本?
- python - 如何模拟掷骰子
- javascript - 使用 chokidar 监视文件,参数“忽略”的正则表达式无效
- javascript - 当我来自 2 个不同的函数时,变量未定义
- c# - 将视图模型从剃刀视图传递到控制器操作
- c++ - 我想不出办法让我的代码循环
- laravel - 无法在私有函数中设置 cookie