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.

  • Is scheduling a task with cron an option? E.g. "send a mail X every day at 15.00 PM". Or in other words, is this task to be scheduled at regular time intervals and can we rely on the fact that the system will be up at a certain X time to perform it? – kos Dec 11 '15 at 10:27
  • I do schedule tasks with cron. At 08.45 I run R-Scriptwhich generates via knitr and LaTeX a PDF in a specific folder/path. The PDF contains daily Google Analytics Report. I just want to attach that PDF automatically. Send Laterseems to be a good tool but its doesnt attach PDFs each morning. Its just attach the PDF you have chosen beforehand. – Mamba Dec 11 '15 at 10:51
  • Yes, the system is always running. – Mamba Dec 11 '15 at 10:57
  • How about just chaining a command to send the mail right at the end of the command you already have in the cron job? That should work unless I'm missing something. – kos Dec 11 '15 at 11:01
  • 2
    all you need is another cronjob to send email immediately after the genration of pdf file. So I see your cron job is running at 08:45 you can use mutt (mutt -s "email subject" -a /home/me/pdfs/query.pdf group@domain.com < /tmp/mail.txt) where mail.txt is the body of email that contains text. So you can put all that in cronjob that will run, say at 08:50 and that will do – ostendali Dec 11 '15 at 13:30

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 me-group@HiThere.com < /home/me/mail/query-report-body.txt


    • -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)
    • me-group@HiThere.com 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.
| improve this answer | |
  • As you've never accepted an answer on this site before: If this answer helped you, don't forget to click the grey at the left of this text, which means Yes, this answer is valid! ;-) – Fabby Dec 13 '15 at 23:28

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.