------------------------------------------------------------------------------- For information on mime and mime type lookups (as well as default application associations) Basic Desktop Mime Handling https://antofthy.gitlab.io/info/misc/mime.txt Mail mime attachments https://antofthy.gitlab.io/info/mail/mail_attachments.txt Desktop Application files https://antofthy.gitlab.io/info/apps/Desktop.txt Gnome Applications https://antofthy.gitlab.io/info/X/Gnome.hints ------------------------------------------------------------------------------- The OLD ".mailcap" file... The ".mailcap" file was used only by mail handlers only. file format mime/type; application "%s" To have it use the modern system use... */*; xdg-open "%s" ------------------------------------------------------------------------------- Mail Attachment Using sendmail! (whole mail, not as an attachment) ( echo "To: to@address" echo "Subject: hello" echo "Content-Type: text/html" echo cat test.html ) | /usr/sbin/sendmail -t ------------------------------------------------------------------------------- Mail Attachment using mutt mutt -e 'set content_type=text/html' -s 'My subject' me@my.com < msg.html ------------------------------------------------------------------------------- Mail Attachment Using xdg-email (and setting a "mailto:" handler) Example... xdg-email --subject "Test Dragon" \ --body "Attached Dragon" \ --attach icons/dragons/Silly_Dragon.jpg \ Anthony.Thyssen@gmail.com This creates a mail which is then opened using a "default mail app" This is defined in mime appliactions "~/.config/mimeapps.list" x-scheme-handler/mailto=claws-mail.desktop WARNING: The xdg system does not understand multiple default appliactions on a single line. ------------------------------------------------------------------------------- Mail Attachment Using mhbuild Add attachments to the mailfile (with headers) #image/x_png; name="arc.png" arc.png Then filter in VI using... :%!mhbuild - ------------------------------------------------------------------------------- General Mail Mime Attachment handling Attachment Filename The file name must be added to the "Content-Type:" line of the attachment. EG: ------- =_aaaaaaaaaa0 Content-Type: application/octet-stream; name=".plan" Content-ID: <10662.1005524452.1@kobold> Content-Transfer-Encoding: base64 Boundary Lines Note that two extra "-" are prepended to the actual boundary lines to the bundary marked given in the header of a mime mail. EG: In the header you have... Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" In the body you have... ------- =_aaaaaaaaaa0 The header has 5 "-" characters but the actual boundary line has 7. Example... To: user@example.com Subject: sending an attachement MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <10662.1005524452.0@kobold> ------- =_aaaaaaaaaa0 Content-Type: application/octet-stream; name=".plan" Content-ID: <10662.1005524452.1@kobold> Content-Transfer-Encoding: base64 CkFudGhvbnkgVGh5c3NlbiA8YW50aG9ueUBjaXQuZ3UuZWR1LmF1PgogIFdXVyBIb21lIFBh Z2U6ICAgICAgIGh0dHA6Ly93d3cuc2N0Lmd1LmVkdS5hdS9+YW50aG9ueS8KICBKb2IgRGVz LS0tCgo= ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <10662.1005524452.2@kobold> Anthony Thyssen ( System Programmer ) http://www.cit.gu.edu.au/~anthony/ ------- =_aaaaaaaaaa0-- -------------------------------------------------------------------------------