Search code examples
htmlcsvcshmutt

How to attach csv in mutt command using C shell


Below is the code I tried with html body with out attaching csv file. It is working fine

#!/bin/csh
mutt -e "set content_type=text/html" -s "status report on" [email protected] < mail1.html

Below is the code I tried when I am trying to attach csv file. But it's not working properly and getting error as shown below.

#!/bin/csh
mutt -e "set content_type=text/html" -s "status report on" -a "sum.csv" [email protected] < mail1.html

Can't stat [email protected]: No such file or directory
[email protected]: unable to attach file.

May I know what went wrong in above code??


Solution

  • If you want your recipient after the attachments, then you must add -- as a separator.

    Check the manual page for mutt:

     -a file [...]
            Attach  a  file  to  your  message  using MIME.  
            When attaching single or multiple files, separating filenames and recipient
            addresses with "--" is mandatory, e.g. mutt -a image.jpg -- addr1
            or mutt -a img.jpg *.png -- addr1 addr2.   The  -a  option
            must be placed at the end of command line options.