如何设置“发件人的电子邮件地址"命令? [英] How to set the From email address for mailx command?

查看:103
本文介绍了如何设置“发件人的电子邮件地址"命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行在Solaris服务器上运行的KornShell(ksh)脚本,当满足错误条件时,该脚本将发送一封电子邮件.我正在通过mailx发送电子邮件.

I am working on a KornShell (ksh) script running on a Solaris server that will send out an email when and error condition is met. I am sending the email via mailx.

问题:如何在mailx命令上设置发件人"电子邮件地址?

Question: How do I set the "From" email address on the mailx command?

当前代码:

echo ${msg_txt} | mailx -s "Script Failure" ${to_email}

注意:该命令可以正常工作,但是,发件人"是我正在运行脚本的用户的名称,并且我希望将此用户名发送到另一个电子邮件地址.

Note: The command works fine, however, the "From" is the name of the user I am running the script as and I would like for this to another email address.

我将如何做到这一点?

How would I accomplish this?

推荐答案

您可以使用"-r"选项设置发件人地址:

You can use the "-r" option to set the sender address:

mailx -r me@example.com -s ...

这篇关于如何设置“发件人的电子邮件地址"命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆