Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending email on CL no longer works with neomutt -H - < message.txt #2606

Closed
scottkosty opened this issue Aug 22, 2020 · 9 comments
Closed
Labels

Comments

@scottkosty
Copy link
Member

Expected Behaviour

I used to be able to send email with the following:

neomutt -H - < message.txt

Actual Behaviour

This now gives the following error:

Refusing to send an empty email
Try: echo | neomutt -s 'subject' user@example.com

Note that message.txt is not empty; it is a valid message complete with headers.

How often does this happen?

  • Always

When did it start to happen?

I can bisect if it it would help. Note that the following seems related: f9476b4, although I think that's just the error reporting. I don't think it was working for this use case before that commit; it just didn't give an error.

NeoMutt Version

NeoMutt 20200821
Copyright (C) 1996-2020 Michael R. Elkins and others.
NeoMutt comes with ABSOLUTELY NO WARRANTY; for details type 'neomutt -vv'.
NeoMutt is free software, and you are welcome to redistribute it
under certain conditions; type 'neomutt -vv' for details.

System: Linux 5.3.0-64-generic (x86_64)
ncurses: ncurses 6.1.20190803 (compiled with 6.1.20190803)
libidn: 1.33 (compiled with 1.33)
OpenSSL: OpenSSL 1.1.1c  28 May 2019
libnotmuch: 5.2.0
storage: tokyocabinet

Configure options: --ssl --sasl --enable-notmuch --enable-debug --tokyocabinet --prefix=/usr/local

Compilation CFLAGS: -g -O2 -std=c99 -D_ALL_SOURCE=1 -D_GNU_SOURCE=1 -D__EXTENSIONS__ -I/usr/local/include -DNCURSES_WIDECHAR

Default options:
  +attach_headers_color +compose_to_sender +compress +cond_date +debug 
  +encrypt_to_self +forgotten_attachments +forwref +ifdef +imap +index_color 
  +initials +limit_current_thread +multiple_fcc +nested_if +new_mail +nntp +pop 
  +progress +quasi_delete +regcomp +reply_with_xorig +sensible_browser +sidebar 
  +skip_quoted +smtp +status_color +timeout +tls_sni +trash 

Compile options:
  -autocrypt +bkgdset +color +curs_set +fcntl -flock -fmemopen +futimens 
  +getaddrinfo -gnutls -gpgme -gss +hcache -homespool +idn +inotify 
  -locales_hack -lua +meta -mixmaster +nls +notmuch +openssl +pgp +regex +sasl 
  +smime -sqlite +start_color +sun_attachment +typeahead 
MAILPATH="/var/mail"
PKGDATADIR="/usr/local/share/neomutt"
SENDMAIL="/usr/sbin/sendmail"
SYSCONFDIR="/usr/local/etc"
@scottkosty scottkosty added the type:bug Bug label Aug 22, 2020
@flatcap
Copy link
Member

flatcap commented Aug 22, 2020

er, I'm not sure what you're trying to achieve.
Both these work:

# Just send the message
neomutt john.doe@example.com -s "subject" < message.txt
# Allow you to edit the envelope and/or edit the email
neomutt john.doe@example.com -s "subject" -H message.txt

In mutt, these two are identical:

# Just send the message
mutt john.doe@example.com -s "subject" < message.txt
mutt john.doe@example.com -s "subject" -H - < message.txt

The slight limit in the behaviour is due to NeoMutt being unable to distinguish two awkward CLI case.
See: #2138 #2243

@scottkosty
Copy link
Member Author

Thanks for the quick reply! As for what I was trying to achieve, my message already has the headers. I would prefer not to have to specify the "to" email address and the subject since it's already contained in message.txt. It's easy enough to write a wrapper that pulls out the subject and the "to" email address, so I don't mind the new behavior and am happy to change to it, but I just want to check that it's desired. To be clear, here is an example of "message.txt":

From: Scott Kostyshak <scott.kostyshak@gmail.com>
To: scott.kostyshak@gmail.com
Subject: testing 123
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
X-Mutt-Fcc: ~/sent

let's see...

s.

@scottkosty
Copy link
Member Author

I think that being able to send an email where the "to:" and "subject:" are specified in the headers is a nice feature of Mutt. Is it possible to do it somehow in the new NeoMutt approach without repeating them in the command and without having to edit the email before sending?

If needed, I can write a wrapper. I just wanted to double-check though that it's necessary since there aren't too many features that Mutt has that NeoMutt doesn't have, although I definitely understand that in some cases it's need to remove a feature to be able to fix bugs or add other features (as you mentioned above the related issues). Is this case one of those necessary sacrifices?

@scottkosty
Copy link
Member Author

@ngortheone Do you by chance have any thoughts on this issue? (I ask because I saw your commit 0ab694d)

@ngortheone
Copy link
Contributor

ngortheone commented Jan 28, 2021

@scottkosty, I can't give you a good answer. My commit only updated man section, porting words from mutt's manual.
I do not (yet) know enough of neomutt code to tell if this works as desired or not. I'd defer this to @flatcap who gave me this task to port the man page wording.

One observation though. Manual says:

Although it is not an mbox file, if an mbox From line is present, it will be silently discarded.

And your message txt has From: Scott Kostyshak <scott.kostyshak@gmail.com>
So it does what the fine print says :)

I believe this intentional corner case was introduced to prevent from accidentally sending an mbox file (mbox is a mail storage format that stores all emails in a single file)

EDIT: neomutt will automatically add FROM field. so you don't need to add it manually. I think you can leave To field

@ngortheone
Copy link
Contributor

Thinking more about this, I think the error message could be a bit more user friendly.

It silently discards your input, because it has "From" field in it. Then it tries to send an email, but there is no contents, and so you get Refusing to send an empty email

IMHO there should be an explicit message saying something like to prevent confusion

Input is discarded because it contains From: field. Please read neomutt(1) for more details

@scottkosty
Copy link
Member Author

@ngortheone Thanks for taking a look! I'm fine either way. We might want to just close this as "wontfix" and document this somewhere as a feature that Mutt has that NeoMutt does not have. Is there already such a list somewhere?

@alejandro-colomar
Copy link
Member

Oops, I forgot to mention this issue in the commit message for 2cdc72a, and CC you in it too. Anyway, the issue has been fixed by that commit.

@scottkosty
Copy link
Member Author

Thanks a lot for your work on it! I'm looking forward to reviving one of my scripts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants