【问题标题】:"mailx" -r command not working“mailx”-r 命令不起作用
【发布时间】:2015-03-28 11:20:21
【问题描述】:

我正在使用以下命令将邮件从一个用户发送到另一个用户,并将附件作为内容放置

mailx -r "sendermail@abc.com" -s "testing" "recievermailid@xyz.com" < emailmessageMail.txt

我收到以下错误消息..

   mailx: invalid option -- r

   Usage: mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...

        [-- sendmail-options ...]

   mail [-iInNv] -f [name]

   mail [-iInNv] [-u user]

有人可以建议..提前谢谢

【问题讨论】:

  • mailx -V mailx: 无效选项 -- V 用法: mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ... [-- sendmail-options ...] 邮件 [-iInNv] -f [名称] 邮件 [-iInNv] [-u 用户]

标签: unix solaris mailx


【解决方案1】:

只需安装

sudo apt-get install heirloom-mailx

bsd-mailx 没有这个选项。 为了检查使用这个命令:

dpkg -S $(readlink -e $(which mailx))

【讨论】:

    【解决方案2】:

    您的mailx 命令版本似乎不支持在命令行中指定发件人地址。在emailmessageMail.txt 文件的开头添加From: 标题行,例如:

    From: sendermail@abc.com
    
    [Message body]
    

    记得用空行分隔标题和正文。

    更新:

    我注意到它还应该支持 sendmail 选项,请参阅[-- sendmail-options ...] 的用法。因此,您可以选择尝试:

     mailx -s "testing" "recievermailid@xyz.com" -- -f "sendermail@abc.com" < emailmessageMail.txt
    

    【讨论】:

      【解决方案3】:

      我在使用 Centos 5 的时候也遇到了这个错误,但是对于 Centos 6 或更高版本就可以了

      #Cenos 5
      mailx -s "subject"  -c "email1" "email2"
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-05-12
        • 1970-01-01
        • 1970-01-01
        • 2014-09-28
        • 2023-04-08
        • 2018-11-14
        相关资源
        最近更新 更多