【问题标题】:mutt: Error sending message, child exited 127 (Exec error.)mutt:发送消息时出错,子进程退出 127(执行错误。)
【发布时间】:2016-04-15 05:59:22
【问题描述】:

我必须从 shell 脚本发送带有附件的邮件。 我正在尝试使用 mutt 来做到这一点,如下所示:How do I send a file as an email attachment using Linux command line?

命令: echo "This is the message body" | mutt -a "/path/to/file.to.attach" -s "subject of message" -- recipient@domain.com

错误:

发送消息时出错,子进程退出 127(执行错误。)。
无法发送 消息。

【问题讨论】:

  • 你安装了msmtp,还是其他用来发送邮件的东西?

标签: email unix mutt


【解决方案1】:

我在 Ubuntu 18.04 上遇到了同样的问题,就像 @jono 一样,我只安装了 mutt。安装

sudo apt-get install sendmail

之后,使用测试方法或直接通过 mutt CLI 发送邮件都可以完美运行。

【讨论】:

    【解决方案2】:

    我今天遇到了同样的错误。 我发现我只安装了 mutt,但是一旦我安装了 sendmail,这个错误就消失了。但是,我随后在本地被阻止。 所以我卸载了sendmail,并安装了这个工作的后缀.. 现在收到附有 pdf 的电子邮件。

    这是在企业环境中的 RHEL 7.4 上。不确定结果在其他版本或环境中是否会有所不同。

    【讨论】:

      【解决方案3】:

      我遇到了这个错误,只需将 below 添加到我的.muttrc。如果这很重要,我正在使用 Gmail。这样我就使用别人的服务器发送,不必安装额外的垃圾。

      set smtp_pass="secrets" set smtp_url = "smtps://username@gmail.com@smtp.gmail.com:465/"

      【讨论】:

        【解决方案4】:

        this link生成的密码设置到这个文件中:

            # file: ~/.muttrc
            set from="first_name.last_name@gmail.com"
            set realname="first_name last_name"
            set imap_user="first_name.last_name@gmail.com"
            #
            # v1.0.1
            # check the following google help page:
            # http://support.google.com/accounts/bin/answer.py?answer=185833
            # that is set here your google application password
            set imap_pass="SecretPass!"
            #nopeset imap_authenticators="gssapi"
            set imap_authenticators="gssapi:cram-md5:login"
            set certificate_file="~/.mutt/certificates"
            #
            # These two lines appear to be needed on some Linux distros, like Arch Linux
            #
            ##REMOTE GMAIL FOLDERS
            set folder="imaps://imap.gmail.com:993"
            set record="+[Gmail]/Sent Mail"
            set spoolfile="imaps://imap.gmail.com:993/INBOX"
            set postponed="+[Gmail]/Drafts"
            set trash="+[Google Mail]/Trash"
            #
            ###SMTP Settings to sent email
            set smtp_url="smtp://first_name.last_name@smtp.gmail.com:587"
            #
            # v1.0.1
            # check the following google help page:
            # http://support.google.com/accounts/bin/answer.py?answer=185833
            # that is set here your google application password
            set smtp_pass="SecretPass!"
            #
            ###LOCAL FOLDERS FOR CACHED HEADERS AND CERTIFICATES
            set header_cache="~/.mutt/cache/headers"
            set message_cachedir="~/.mutt/cache/bodies"
            set certificate_file =~/.mutt/certificates
            #
            ###SECURING
            set move=no  #Stop asking to "move read messages to mbox"!
            set imap_keepalive=900
            #
            ###Sort by newest conversation first.
            set sort=reverse-threads
            set sort_aux=last-date-received
            #
            ###Set editor to create new email
            set editor='vim'
        
            set ssl_starttls=yes
            set ssl_force_tls=yes
        

        【讨论】:

          【解决方案5】:

          修复 GMail 帐户配置

          以下帖子对我有用:https://www.codyhiar.com/blog/getting-mutt-setup-with-gmail-using-2-factor-auth-on-ubuntu-14-04/

          但不是很清楚。对我有用的~/.muttrc 的内容如下(我的帐户启用了两步验证,我必须按照帖子中的说明生成应用密码):

          set imap_user = "<username>@gmail.com"
          set imap_pass = "<16-character-app-password>"
          
          set sendmail="/usr/sbin/ssmtp"
          
          set folder="imaps://imap.gmail.com:993"
          set spoolfile="imaps://imap.gmail.com/INBOX"
          set record="imaps://imap.gmail.com/[Gmail]/Sent Mail"
          set postponed="imaps://imap.gmail.com/[Gmail]/Drafts"
          
          set header_cache = "~/.mutt/cache/headers"
          set message_cachedir = "~/.mutt/cache/bodies"
          set certificate_file = "~/.mutt/certificates"
          
          set from = "<username>@gmail.com"
          set realname = "<name-used-in-the-gmail-account>"
          
          set smtp_url = "smtp://<username>@smtp.gmail.com:587/"
          set smtp_pass="<16-character-app-password>"
          
          set move = no
          set imap_keepalive = 900
          
          # Gmail-style keyboard shortcuts
          macro index,pager ga "<change-folder>=[Gmail]/All<tab><enter>" "Go to all mail"
          macro index,pager gi "<change-folder>=INBOX<enter>" "Go to inbox"
          macro index,pager gs "<change-folder>=[Gmail]/Starred<enter>" "Go to starred messages"
          macro index,pager gd "<change-folder>=[Gmail]/Drafts<enter>" "Go to drafts"
          macro index,pager e "<enter-command>unset trash\n <delete-message>" "Gmail archive message" # different from Gmail, but wanted to keep "y" to show folders.
          

          替换以下内容:

          1. &lt;username&gt;: 你的 gmail 用户名
          2. &lt;16-character-app-password&gt;:你必须生成这个
          3. &lt;name-used-in-the-gmail-account&gt;: gmail 帐号中你的名字

          注意:不要更改&lt;change-folder&gt;

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2022-08-03
            • 1970-01-01
            • 2016-03-30
            • 1970-01-01
            • 1970-01-01
            • 2021-11-27
            相关资源
            最近更新 更多