error sending email via mutt/msmtp w/ cronjob (status 0x0001 from MTA#012)
by jorjor242 from LinuxQuestions.org on (#5214Q)
his bash script works fine when run from CLI -
Quote:
However, I tried to install a cronjob to run it daily but it isn't working, this is the job:
# m h dom mon dow command
* * * * * root /home/osboxes/Downloads/sendlogzzz.sh
sudo crontab -l :
# m h dom mon dow command
* * * * * root /home/osboxes/Downloads/sendlogzzz.sh
(I intentionally set it to send every minute to see if it would work).
I looked sudo grep CRON /var/log/syslog :
Quote:
This is my ssmtp config:
Quote:
Based on what I've read on other threads it looks like the proper format...not sure what to troubleshoot


Quote:
#!/bin/bash tail -n 50 /var/log/suricata/fast.log > "$(date '+%Y-%m-%d_%H-%M-%S').log" echo "Hello this is the body message, we are sending email with attachement using mutt and msmtp" | mutt -a /home/osboxes/Downloads/"$(date '+%Y-%m-%d_%H-%M-%S').log" -s "this is the subject of the message" -- xxxx@gmail.com |
# m h dom mon dow command
* * * * * root /home/osboxes/Downloads/sendlogzzz.sh
sudo crontab -l :
# m h dom mon dow command
* * * * * root /home/osboxes/Downloads/sendlogzzz.sh
(I intentionally set it to send every minute to see if it would work).
I looked sudo grep CRON /var/log/syslog :
Quote:
Apr 10 16:32:01 osboxes CRON[1430]: (root) MAIL (mailed 28 bytes of output but got status 0x0001 from MTA#012) Apr 10 16:33:01 osboxes CRON[1675]: (root) CMD (root /home/osboxes/Downloads/sendlogzzz.sh) Apr 10 16:33:02 osboxes CRON[1674]: (root) MAIL (mailed 28 bytes of output but got status 0x0001 from MTA#012) Apr 10 16:34:01 osboxes CRON[1932]: (root) CMD (root /home/osboxes/Downloads/sendlogzzz.sh) Apr 10 16:34:01 osboxes CRON[1931]: (root) MAIL (mailed 28 bytes of output but got status 0x0001 from MTA#012) |
This is my ssmtp config:
Quote:
root=postmaster SERVER=xxx@gmail.com # The place where the mail goes. The actual machine name is required no # MX records are consulted. Commonly mailhosts are named mail.domain.com mailhub=smtp.gmail.com:587 AuthUser=xxx@gmail.com AuthPass=xxx UseTLS=YES UseSTARTTLS=YES # Where will the mail seem to come from? rewriteDomain=gmail.com # The full hostname hostname=osboxes.lan # Are users allowed to set their own From: address? # YES - Allow the user to specify their own From: address # NO - Use the system generat |
Based on what I've read on other threads it looks like the proper format...not sure what to troubleshoot