Mutt command error

Hello there,

I am using "mutt" command to send e-mails.

mutt -s "Mail subject line" $( printf -- '-a attachment_name') < "mail body file" "e-mail id" 

I wish to change the name of the attachment by appending the date to it.
Something like "attachment_name_$DATE.html" in the mutt command.

However, I am getting the error as :

Can't stat attachment_name_$DATE.html: No such file or directory
attachment_name_$DATE.html: unable to attach file.

Could you please help.

Thanks,
Haider

You know that shell expansion doesn't work between single quotes?

Hello RudiC,

Could you please help me with the correct command.

Thanks,
Haider

Try double quotes in lieu of the single quotes.

Hello

Now I do not get any attachment in the mail.

the code being used is :

mutt -s "Mail subject line" $( printf -- "'-a attachment_name'") < "mail body file" "e-mail id" 

Thanks,
Haider

In above, get rid of the single quotes entirely.