I set the cronjob and I saw it is running good. I follow the tutorial but do not see the email coming. Please help.
MAILTO=”example@digitalocean.com”
#This is a comment
* * * * * echo ‘Run this command every minute’
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
What command are you using to send emails?
In the snippet you provided, you used this command:
- echo ‘Run this command every minute’
The echo command is used to output the message to the terminal output. To send it as a email, you need to pipe it to some email client.
The exact steps are depending on the setup you have, i.e. how did you set up your email server.
For example, if you’re using Postfix (e.g. set up by following the How to Install and Configure Postfix as a Send-Only SMTP Server on Ubuntu 16.04 tutorial), you can use command such as:
- echo ‘Run this command every minute’ | mail -s 'subject' $MAILTO
If you’re using the correct command in your crontab file, try to execute it like a normal command, in your terminal. If you’re a new DigitalOcean user, it could be that SMTP protocol needed to send emails is disabled for your account. In that case you would have to open the support ticket to request to get it enabled for your account.
Also, maybe it could be useful to check your logs. Check does syslog (/var/log/syslog) contains some useful logs.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.