mutt:发送消息时出错,子退出127(执行错误。)

时间:2016-04-15 05:59:22

标签: email unix mutt

我必须发送一封带有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(执行错误。)。
无法发送   消息。

5 个答案:

答案 0 :(得分:2)

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

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

答案 1 :(得分:2)

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

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

答案 2 :(得分:1)

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

答案 3 :(得分:0)

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

sudo apt-get install sendmail

之后,使用测试方法发送邮件或直接通过mutt CLI发送邮件即可。

答案 4 :(得分:0)

修复GMail帐户配置

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

但这不是很清楚。适用于我的 Participant_ID Primary_health_complaint q2.2_healthCat 1 1 3 2 2 2 7 2 3 3 12 3 4 4 11 3 5 5 3 2 6 6 1 1 7 7 9 3 8 8 4 1 9 9 6 1 10 10 2 1 的内容如下(我的帐户启用了两步验证,并且我必须按照帖子中的描述生成应用密码):

~/.muttrc

替换以下内容:

  1. 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. :您的Gmail用户名
  2. <username>:您必须生成此
  3. <16-character-app-password>:根据gmail帐户输入的姓名

注意:请勿更改<name-used-in-the-gmail-account>