Background: I'm trying to set up a server to regularly pull RSS feeds, package them up in a mobi-ebook and send them to my kindle.
Problem: If I configure the server to send to my @kindle.com email address (as described here: https://www.amazon.com/gp/sendtokindle/email) I get back an email telling me:
Your email to Kindle(s) did not include any attachments.
I'm using the following command to send the email with attachment:
echo "See attachment" | mail -s subject -aFrom:"$EMAIL_FROM" -A $EMAIL_FILE -r $EMAIL_FROM $EMAIL_TO
I tested this command by sending it to my personal email address instead of the @kindle.com one. The email appeared correctly with attachment in my personal inbox.
Interestingly it works fine (as in the ebook appears on my kindle) if I use mutt like this:
echo "See attachment" | mutt -s subject -a $EMAIL_FILE -- $EMAIL_TO
I'm using postfix to forward the emails to a hosted smtp server. I already checked the postfix logs (/var/log/mail.log
) but couldn't see any differences between the two methods above. The server is running Ubuntu 18.04.
Question: Why does it work with mutt
but not with mail
? How would I troubleshoot such an issue?
Requested information
The headers from mutt (Please let me know if I stripped out too much):
Delivered-To: [...]
Received: by 2002:a2e:9c0f:0:0:0:0:0 with SMTP id s15-v6csp1355528lji;
Sat, 10 Nov 2018 10:47:03 -0800 (PST)
[... removed X-* ...]
[... removed ARC-* ...]
Date: Sat, 10 Nov 2018 18:46:44 +0000
From: [...]
To: [...]
Subject: mutt
Message-ID: <20181110184643.GA23337@server>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="5mCyUwZo2JvN/JJP"
Content-Disposition: inline
User-Agent: Mutt/1.9.4 (2018-02-28)
[... removed X-* ...]
--5mCyUwZo2JvN/JJP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
See attachment
--5mCyUwZo2JvN/JJP
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="20181024T0942.mobi"
Content-Transfer-Encoding: base64
--5mCyUwZo2JvN/JJP--
Headers from mail:
Delivered-To: [...]
Received: by 2002:a2e:9c0f:0:0:0:0:0 with SMTP id s15-v6csp1355767lji;
Sat, 10 Nov 2018 10:47:23 -0800 (PST)
[... removed X-* ...]
[... removed ARC-* ...]
MIME-Version: 1.0
Content-Type: application/octet-stream; name="20181024T0942.mobi"
Content-Transfer-Encoding: base64
Subject: mail
To: [...]
X-Mailer: mail (GNU Mailutils 3.4)
Message-Id: <20181110184707.B984A5EAE4@server.localdomain>
Date: Sat, 10 Nov 2018 18:47:07 +0000 (UTC)
From: [...]
[... removed X-* ...]
Upon closer inspection I noticed that the one from mail
is missing the text "See attachment".
Versions:
jonas@server:~$ mutt -v
Mutt 1.9.4 (2018-02-28)
[...]
jonas@server:~$ mail --version
mail (GNU Mailutils) 3.4
[...]
jonas@server:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
According to the man page on the server I'm using -A
correctly:
-A, --attach=FILE
attach FILE
-a, --append=HEADER: VALUE append given header to the message being sent