How to schedule emails with varying content?

I recently moved to Ubuntu 14.04 and encounter my first problems. I would like to create a schedule for automatic email transmission. I'm running some queries every morning via cron which are saved as report query.pdf in one specific path.

I would like to send an email afterwards to a specific group of recipients using the preinstalled Thunderbird client. I have already found Send later. However, it doesn't attach thequery.pdf when the content changes every morning.

Is there another way or add-on? I just couldn't find anything at all.


Solution 1:

Yes, it's possible to install an SMTP send connector on your Microsoft Exchange server and then it's just a question of:

  • configuring sendmail
  • adding the following line to your cron script:

    mutt -s "query report" -a /home/me/pdfs/query.pdf [email protected] < /home/me/mail/query-report-body.txt
    

    where:

    • -s subject is the subject of the message. (query report in the example above)
    • -a file is the attached report file to your message. (example taken from your comment)
    • [email protected] is the SMTP address of the Exchange group you're sending the mail to.
    • query-report-body.txt is the text file containing the body message of your report.