Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Send email via cron

Discussion in 'E-mail Discussions' started by Madhu Sharma, Oct 22, 2016.

Tags:
  1. Madhu Sharma

    Madhu Sharma Registered

    Joined:
    Oct 22, 2016
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    UK
    cPanel Access Level:
    Website Owner
    How can I use cron to send email on a schedule (e.g. every 5 minutes). The content of the email does not matter.

    I want to do this to trick Gmail into checking my external accounts more often. I had done this in the past, but I have forgotten what I did!
     
  2. SysSachin

    SysSachin Well-Known Member

    Joined:
    Aug 23, 2015
    Messages:
    569
    Likes Received:
    40
    Trophy Points:
    28
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hi,

    Yes, you can able to send mail using mail script but first you have to confirm your hosting provider if they are allow such cron on the server as most of the hosing provider not allow such cron due to server IP blacklist issue.
    If you own server/vps then let me know so that I will assist you.
     
  3. Madhu Sharma

    Madhu Sharma Registered

    Joined:
    Oct 22, 2016
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    UK
    cPanel Access Level:
    Website Owner
    Thanks for replying. I am shared hosting, but I was able to do this in the past and it worked, so it must be allowed.
    I just deleted the cron command by mistake and now can't remember it!
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,659
    Likes Received:
    1,428
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Were you previously using the "mail" command? There's an old thread here where the method of doing this is discussed:

    send email from ssh?

    Or, have you considered sending email via a PHP script? If so, you'd simply setup the cron job to execute the PHP script that sends email. Here's an example:

    Code:
    php /home/username/public_html/mailer.php
    Here's a document to follow if the system uses EasyApache 4:

    EasyApache 4 and the ea-php-cli Package - EasyApache 4 - cPanel Documentation

    Thank you.
     
Loading...

Share This Page