I have the simplenews module configured to send my newsletter out using the cron hook (so I don't swamp my server by sending all the emails at once).

I have the automatic cron set to run every hour.

Cron does run (I get a message) but no emails are delivered.

However, if I force the cron by visiting http://www.somesite.com/cron.php, emails _are_ sent out.

Any ideas why the automatic cron is ignoring simplenews scripts?

Thanks,
Kevin

Comments

RobRoy’s picture

It should be the same thing. It's possible cron is not actually running. Are you doing something to the effect of "wget http://example.com/cron.php" as per http://drupal.org/cron?

--
Rob
Founder and Director
Electronic Insight Corporation

Recent Drupal Projects: MP3PIG | MySpace Layouts

kmillecam’s picture

That's what's goofy, Rob.

I see entries in my watchdog log showing that the script is indeed running every hour. But, the simplenews portion never runs.

Funny thing, when I click the URL in the log (http://example.com/cron.php), the cron runs and the simplenews script starts running.

I haven't a clue what's going on.

The command I'm using in my cron is "/usr/bin/lynx -source http://gwavanation.com/cron.php"

TIA,
Kevin

http://www.webwiseone.com
It's all about community.

https://bkjdigital.com
We make magic.

iedude@remote.insidetheie.com’s picture

I had (almost) the exact same problem just a few days ago..
Cron.php via URL ran fine (based on watchdog), but thru my scheduler, would not run. I know the scheduler was kicking-off cron.php because i threw in some code to send me an email when it starts..

turns out i had a bad module - once disabled, everything started working fine.. I have no clue why it was working via URL, but not the unix scheduler (CRON-like, but not 'cron') ..

kmillecam’s picture

Thanks iedude, that helps.

Do you happen to remember which of your modules was bad?

Kevin

http://www.webwiseone.com
It's all about community.

https://bkjdigital.com
We make magic.

iedude@remote.insidetheie.com’s picture

I think it was the TROLL module..
i re installed it, and then it was fine.

kmillecam’s picture

It looks like part of my cron is running but somewhere, it's hanging up.

1) Watchdog entry does get updated every hour
2) Aggregator does bring in new feeds every hour

but,

1) Search tables do not appear to be updated (according to each table's "last updated" field.
2) Simplenews newsletter is not being sent.

TIA,
Kevin

http://www.webwiseone.com
It's all about community.

https://bkjdigital.com
We make magic.

DriesK’s picture

This issue has been solved. It was related to the node permission system of og.module, which didn't allow access to newsletters for anonymous.

BarisW’s picture

Apologies for kicking this up, but I have exactly the same problem. When I call my cron script from the browser (anonymous of as user, doesn't matter) the newsletter are sent out. However, when I call the cron script using cron (wget) they are not send. The watchdog tells me the cron has ran, but the newsletters are never send.

Does anyone know what the reason of this problem is?

Thanks,

Baris

Baris Wanschers (@BarisW)
Drupal specialist

john spain’s picture

Can an anonymous user view the newsletter node in the browser?

I had a similar problem because I applied a category to the newsletter node but forgot to allow anonymous users to list/view nodes in the category.

Because the system cron invokes the cron.php script as an anonymous user, the database query used in the simplenews.module returned an empty result set until I fixed the category permissions.

graphicengineer’s picture

Thanks Jack Sprat -- had similar problems and once I enabled the anonymous user for the newsletter the emails went out! Much appreciated for posting this.

ardee-1’s picture

Interesting! I had the same symptom (runs OK from command line but not in crontab) but with a completely different cause.

I had used a PC-based text editor to create a crontab file that I then uploaded to the host and used with "crontab (filename)". Running "crontab -l" indicated that everything was OK, but in reality it wasn't. I was sure I'd told the text editor to use Unix-style line endings, but in the end that must have been the problem (either that or perhaps a blank line at the end of the file I'd passed to crontab, which it apparently also can't handle).

This cost me 1.5 days. Hope some day, somebody finds this and avoids a similar fate!

igbonine’s picture

Just a bookmark

fuquam’s picture

I've tried everything suggested but the newsletters are not being sent. It says they've been sent but they haven't. Running cron manually doesn't seem to do the trick either.

barraponto’s picture

probably running cron from server loads php-cli, which has its own memory limit set in /etc/php5/cli/php.ini (or something like this).
it is usually different from the apache module php.ini.

Capi Etheriel
Web Developer, Designer and Scraper
http://barraponto.dev.br

fuquam’s picture

I don't have a php5 directory in the /etc directory.

I've since been able to use cron to send Simplenews but now the problem is it send duplicates. I checked the logs and it looks like it sends one by cron and one by mime.

spyros12a’s picture

Recently I had some problems when sending e-mails with simplenews newsletter module for Drupal. While this is a very good module, sometimes made Drupal cron to fail and stuck. I also wanted full control on sending mails and to avoid some of the limitations of Drupal cron timings. Since I didn't have the time to enhance the simplenews module I did this script to be sure that my mails are sent. This script needs simplenews newsletter module and Drupal in order to work. It has been tested with Drupal 7 (but should work on any version) and simplenews 7.

The script works out of drupal and speaks to the database so its better for performance and mail control. You can set the time step and the mails it sends every time based on your server sending limits. At the end logs any bad mails. For me it is the solution for sending my newsltters.

You can learn more and get the script from

http://tecorange.com/content/mail-send-addon-drupal-simplenews-newsletter