Skip to main content

Send email via cron

Comments

5 comments

  • SysSachin
    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.
    0
  • Madhu Sharma
    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.

    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!
    0
  • cPanelMichael
    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:
    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.
    0
  • mamati.yazdanbakhsh
    hello we have spam mail for run cronjob and we click the updat mail for clear mail default but again send mail please read the this log mail
    Return-path: Received: from vakilcom by cloudirx120.hostnegar.com with local (Exim 4.93) (envelope-from ) id 1ko1Og-000PiZ-BY for vakilcom@cloudirx120.hostnegar.com; Sat, 12 Dec 2020 13:11:02 +0330 From: "(Cron Daemon)" To: vakilcom@cloudirx120.hostnegar.com Subject: Cron /home/vakilcom/public_html/wp-content/svg-attributes_64 (deleted) > /dev/null 2>&1 Content-Type: text/plain; charset=UTF-8 Auto-Submitted: auto-generated Precedence: bulk X-Cron-Env: X-Cron-Env: X-Cron-Env: X-Cron-Env: X-Cron-Env: X-Cron-Env: X-Cron-Env: X-Cron-Env: Message-Id: Date: Sat, 12 Dec 2020 13:11:02 +0330 /bin/sh: -c: line 0: syntax error near unexpected token `deleted' /bin/sh: -c: line 0: `/home/vakilcom/public_html/wp-content/svg-attributes_64 (deleted) > /dev/null 2>&
    0
  • ffeingol
    Assuming you have access to all the commands via shell:
    cal | mail -s "test email" someone@example.com
    The Linux cal command will create a text calendar for this month and it gets piped into the Linux mail command. The subject (-s) is "test email" and it's sent to someone@example.com. Will that work for you?
    0

Please sign in to leave a comment.