Linux: mailx, how to sent an email with an attachment and how to add timestamp to subject

Scenario: we want to sent an email using mailx, the email must contain an attachment and the subject should be modified with a timestamp

Scenario: we want to sent an email using mailx, the email must contain an attachment and the subject should be modified with a timestamp

solution:echo "blah blah blah! ~ $(date)." | mailx -r do.not.reply@test.com -s "Report: $(date)" -a ~/report/report.zip -S smtp=mysmtp kpatronas@gmail.com

The echo part inserts the body of the email message, -r is the sender address, -s the subject -a the attachment -S the smtp server to use, and kpatronas@gmail.com the recipient email address, we can have as many we want space delimited.

$(date) inserts to the string the current datet time.