I am really not sure what's up with simplenews. We haven't been able to send out a newsletter now for a while. It all looks like it is sent according to the web interface, but I never get the mail and there is noting in /var/log/maillog to indicate that something has actually gone out.

I can see in the logs that "simplenews: added OpenConcept Newsletter - June 19, ..." has been added. I added extra watchdog calls for _simplenews_send & simplenews_mail_send but neither of these are showing up in the logs.

I do get to simplenews_nodeapi because I am getting the drupal message "'Newsletter %newsletter is being sent" (although with the title filled in appropriately).

Any ideas on troubleshooting this further?

Mike

Comments

sutharsan’s picture

If _simplenews_send() is not called, than cron is not running and the status of the newsletter should be 'pending' (blue clock icon).
Can you confirm?

mgifford’s picture

Cron's getting run regularly (and I ran it manually a few times too). And I don't see the pending blue clock after I save it. It goes right to sent.

It did work a few months ago when we last had the time to put out a newsletter.

Wonder if there's a conflict with one of the other modules.

Mike

citizenkate’s picture

I had this problem and then realised that the list of subscribers to that newsletter had un-explainably disappeared! Is this happening for you?

mgifford’s picture

I can see them when I look at my subscribers here /admin/content/newsletters/users

Just not sure why nothing is going out. There should be better mechanisms to track this with watchdog.

Mike

sutharsan’s picture

Need more details on this. Where exactly did you put the watchdog calls (as you mention in your initial post)?
As you can see in code the simplenews_cron() calls _simplenews_send(); no conditions. And therefore I can not match #2 with you initial issue description.

Please check the simplenews_subscriptions table for the s_status. They should all be 0 (zero).

mgifford’s picture

I was placing my watchdog calls in the function simplenews_mail_send() as I recall. I removed the test instance I was playing with. I was working back from drupal_mail().

s_status is all 0 as it apparently should be.

Where do you want me to place the debugging calls?

sutharsan’s picture

Status: Active » Closed (fixed)

If there is a need for further testing, feel free to re-open this issue.

parasjain01’s picture

Status: Closed (fixed) » Active

I am also facing the same problem. I have tried changing the s_status value to 0 in the simplenews_newsletters table to re-send it. After sending it through the form the s_status changes to 1. Then I run the cron manually a couple of times. But the newsletters don't go. I just get blue clock saying newsletter is being currently sent by cron. I tried sending with high priority but that also did not work.

http://www.rajadhirajayoga.net/

sutharsan’s picture

Sorry, can't help you with the information you supplied.

parasjain01’s picture

Version: 5.x-1.1 » 6.x-1.x-dev

Sorry for not being clear last time. Simply put, my newsletters are not going through. When I send the test newsletter to myself it goes instantly, but when I actually send the newsletters to all my subscribers none of the subscriber gets it. The newsletter moves from the "Draft" tab to "Sent Issues" tab with a blue clock showing on the "Sent" column. When I hover my mouse over the blue clock it says "Currently sending by cron". Running the cron manually also doesn't work.

To solve this issue I tried flipping back s_status of simplenews_newsletters table to 0 and then re-sending the newsletter a couple of times but that didn't work either.

Hope this time I am clear. Let me know if you need any specific information.
Thanks in advance.

STNyborg’s picture

Silly question: have you checked your email spam filter. I have also experienced that emails WERE in fact sent out from the Drupal system (also confirmed by the watchdog logs) but were caught in the users' spam filters. If I send out the newsletter as plain text (NOT HTML-format) the email is received at the receiving end.

I am not saying that plain text format is the solution, but that html-formatted emails seem to cause problems with users' spam filters.

parasjain01’s picture

No, emails are not there in the spam folders. I have checked that. Also the status of the newsletter is "Currently being sent by cron"

sutharsan’s picture

Status: Active » Postponed (maintainer needs more info)

Simplenews has a setting to log the outgoing email at admin/settings/simplenews/mail
The latest 6.x-1.x-dev also a reports of the number of successfully sent emails each cron run.

jriedel’s picture

I also just tried to send out my first newsleter and nothing got sent. I forced cron to run and nothing. What I did to get around it was to unlcik the box for sending via cron, so it does it right now. Then it worked.

It's not a SPAM issue, nothing got sent the first time.

So I think the common thing is something with cron.

parasjain01’s picture

I tried that too but it doesn't work. Well, I will try once more. This time I will uninstall the module itself, then re-install and then try various options

parasjain01’s picture

I have updated to the latest simplenews module mentioned by Sutharsan.
When I disabled cron, around 500 mails were sent immediately(as per the log messages in the report) and because of some issues(as per log message) it got interrupted. Then I manually run cron for 500 more subscribers. Currently the status says newsletter is sent. But I did not get the email in my inbox. I will check with my other users in the morning.

sutharsan’s picture

Did you use the log I described in #13? If so each outgoing email should be listed in the log. Important!


Sending with cron and sending without cron (Simplenews setting) uses exactly the same code. Without cron the email is send to _all_ subscribers, using cron it is limited to the Cron throttle amount.


Perhaps the below description of data flow within simplenews will aid debugging.


This is what simplenews does
when a newsletter is saved for sending (simplenews_send_node):
* Build list of subscribers
* Store subscriber's email, node id and status (pending = 1) in simplenews_mail_spool table.
* Send to all subscribers of this node (see: simplenews_mail_send)
* Flush spool table (see: simplenews_clear_spool)


When cron runs (simplenews_cron):
* send to all pending in spool (simplenews_mail_send)
* flush spool table (simplenews_clear_spool)


simplenews_mail_send:
* Retrieve data from spool
* Send to each address
* load node
* build email according to subscriber language
* send (if installed) via mime mail or drupal mail
* log succes/failure in system log
* check for PHP execution time overrun
* update spool table with status (send = 2)
* log summary in system log


simplenews_clear_spool:
* delete all send records from table according to spool expiration setting

parasjain01’s picture

Thanks Sutharsan for your information.
Yest I get detailed log also. Actually it logged messages that the mails are sent but actually mail did not go to any of my users. I checked today.

The log messages are like this--

Outgoing email. Message type: node
Subject: [Rajadhiraja News] Rajadhiraja Yoga News Dec 2008 Inaugural Issue
Recipient: abc@abc.com
Sent via Mime Mail

In the details column of watchdog table the entry is like this

"a:4:{s:5:\"%type\";s:4:\"node\";s:3:\"%to\";s:17:\"abc@abc.com\";s:8:\"%subject\";s:60:\"[Rajadhiraja News] Rajadhiraja Yoga News Dec 2008 Inaugural Issue\";s:9:\"%mimemail\";s:24:\"
Sent via Mime Mail\";}"

simplenews_send_node runs properly, simplenews_mail_send runs properly and it logs the succesfully sent message properly and status of newsletter and individual emails in spool is flipped.
Two things not working
i) Emails are not actually sent
ii) Spool are not cleared. There are still records in the spool table with the status 2.

Please note that test mails are sent however, the problem is with actual mail sending

ñull’s picture

I see the same problem here. My log says: simplenews 11/12/2008 - 20:55 0 emails sent in 0 seconds. . The simplenews node I tried to send has the indication This newsletter has been sent greyed out and active.

Furthermore the test email sending doesn't work either. A new node is saved with the notification ... has been created., but nothing about being sent like usual.

Then I started looking into other influences and deactivated mimemail and smtp authentication modules. I noticed that the activation of mimemail is what stops the mail delivery in my particular case. Can others confirm this?

sutharsan’s picture

If you have the 'Outgoing email.' messages in the log then it is almost 100% sure that the emails are delivered by PHP to the mail server. Check with your webhost or mail host if they have any logs. Some hosts have very strict limits. Try sending 1 email per cron cycle and see if it comes through.

The spool is cleared some time after sending. 'Mail spool expiration' setting determines the time. Cron takes care of this.

jriedel’s picture

For me the first time I tried it I didn't have the logging turned on. When I chnage it to send them now, and not with cron, then the mail got sent and I had messages in the logs. So I know my problem is not the mail server. I used to do a mailing list with hand made PHP code on this same server over the past 4 years, I've worked over all the issues with mail not getting sent. This is not the case for me. The mail server is good, sending a mass of mails at one time is good. Something is odd with the way it is happening with cron.

Now that I have the logging turned on, I'll do the next news leter with it and see what shows in the logs, however I thing the next one will not be sent for about another week or so.

ñull’s picture

In my case, with module mimemail active, I don't see a mail send logged, so php did not sent the message. It cannot be a mail server issue.

I am still in the test phase before it is taken to production and I am using the test email function or to only a few subscription addresses. I should not be hitting mail server limits that way.

sutharsan’s picture

In test phase you can use the Devel module which has a setting to divert the mail output to the log. Very handy to see if email is actually sent! But double check if this plays nicely with mime mail. It have used it with simplenews without mime mail.

When you turn on simplenews mail logging it shows fail or success ('Outgoing email' or 'Outgoing email failed') in the log for each email.

sutharsan’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

No activity, closing the issue.

jurgenhaas’s picture

Status: Closed (fixed) » Active

OK, this is pretty old but I have to reactivate this issue. I came across the very same effect and after almost a complete night over the code I found the reason for not sending email.

Simplenews does this:

$headers['From'] = $params['from']['formatted'];

and with that it gets reported that the email is sent. But it's never delivered.

Changing that line to this:

$headers['From'] = $params['from']['address'];

and all is just working fine.

Any idea what the real reason then might be?

jurgenhaas’s picture

Status: Active » Needs review
StatusFileSize
new583 bytes

There was no response from the community yet but I have tested it successfully for weeks and therefore I'm submitting a patch and hope this goes into the module.

sutharsan’s picture

Status: Needs review » Postponed (maintainer needs more info)

@jurgenhaas, this may solve your problem, but removes a feature from the module (a formatted From address). Please investigate the problem behind your problem and we can develop a real solution.

jurgenhaas’s picture

@Sutharsan, well es I posted in #25 I have no idea what the problem is, most probably it's the mail address formatting that causes some mail servers to have an issue. Looks like other seem to have the same issue.

It might be an option to implement this as a configurable switch to either have formatted or plain addresses?

jurgenhaas’s picture

@Sutharsan, maybe the following note from http://php.net/manual/en/function.mail.php may help understand what happens and needs to be done:

Note: The Windows implementation of mail() differs in many ways from the Unix implementation. First, it doesn't use a local binary for composing messages but only operates on direct sockets which means a MTA is needed listening on a network socket (which can either on the localhost or a remote machine).

Second, the custom headers like From:, Cc:, Bcc: and Date: are not interpreted by the MTA in the first place, but are parsed by PHP.
As such, the to parameter should not be an address in the form of "Something ". The mail command may not parse this properly while talking with the MTA.

sutharsan’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new852 bytes

thanks, that makes sence. Try the attached patch, I guess this should work and not cause side effects on non windows systems.

jurgenhaas’s picture

Works for me. Than ks a lot, great aproach.

sutharsan’s picture

Status: Needs review » Fixed

Thanks for testing. Patch committed. Marking this issue fixed although the original author's problem may not be solved.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.