I am searching for a way to automatically attach a file ~/.mutt/example.vcf to any mail I compose with mutt.

I tried something like send-hook 'attach-file ~/.mutt/fauve.vcf' but it doesn't work.

Have you, please, any idea how to do that ?


The following works for me in neomutt 20180716

macro compose y ":exec attach-file<enter>myfile.txt<enter>:exec send-message<enter>"

To explain:

  • macro compose y -- override the y key in the compose menu to run a macro instead of just sending
  • :exec attach-file -- opens the mutt prompt for a filename to attach
  • myfile.txt -- enters the name of the file to attach and presses enter
  • :exec send-message -- runs the send email command

I dont know mutt, but I can tell you in mail or mailx I usually do uuencode myAttachment.tar.gz attachmentName | mail -s "Here is that dolphin porn you requested" somedude@earthlink.cc.net.foo

  • uuencode wasn’t installed in my system and was able to send mails with mutt.
    – fauve
    Jan 13 '14 at 17:34


Easiest solution consist in to just create a simple alias for mutt:

alias mutt="/usr/bin/mutt -a $HOME/.std.vcf"

so if you enter mutt mutt -a $HOME/.std.vcf will be executed. That's it!

Normally in order to compose a email with attachments mime-construct is used:

mime-construct --to "nerd@example" --subject 'hi there' \
--string "test" --file-attach /etc/motd

There are some solutions to automaticly add your *.vcf:


However, it is unusual to use vcf on unices where a signature is more common.

  • I haven’t mime-construct installed so I can send mails with mutt. Then, if what I want to do need the installation of mime-construct, I will install it.
    – fauve
    Jan 11 '14 at 23:51
  • Thank you for vcf-to-mutt and muttquery. I will try them. Yes, I can use a link to my vcf but some email program sync automatically the addressbook when they found a vcf as an attachment. That’s why I prefer this way :)
    – fauve
    Jan 13 '14 at 17:36
  • Vcf-to-mutt is an interesting script. Thank you o/ but it doesn’t resolve my problem :) Perhaps the solution are very complicated. Then as you tell me I will probably forget this idea and only quote the link to my vcard in a signature. Thank you.
    – fauve
    Jan 16 '14 at 18:25
  • updated alias solution
    – user55518
    Jan 16 '14 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.