I am running Simplenews 6.x-2.0-alpha2 with current MIME Mail module on Drupal 6.22.
Sending both test newsletters directly with PHP and real newsletters via cron works. If a user tries to subscribe to a newsletter (double opt-in), however, no email is being send. Furthermore no email address is stored (but maybe that's because no confirmation link was called yet?). Permission for anonymous users to subscribe was granted.
So as sending newsletters to already subscribed users works, there must be some issue inside Simplenews why confirmation emails are not triggered. Any suggestions?
Comments
Comment #1
simon georges commentedIs the unsubscribe mail triggered when a subscribed user wants to opt out?
Comment #2
Actron commentedNo, neither subscribe nor unsubscribe emails are being sent, when double opt-in is activated. I can only send test and real newsletters.
By the way: There is no unsubscribe button in Simplenews' single sign-up block, which is very uncomfortable.
Comment #3
Actron commentedChanging priority to major, because guest user cannot subscribe to newsletters.
Comment #4
simon georges commentedAre standard Drupal mail (register, and so on) being sent? Can you try when deactivating MimeMail?
Comment #5
Actron commentedTried without MIME Mail, but did not change anything. All other emails are being sent, except for opt-in/opt-out messages.
When I confirm the subscribe form, I even get a message that tells me to check my emails for confirmation. Do users already show up in the subscriber manager, when confirmation is pending? Because there is no new enty, too. So it seems there is nothing taking place in the background, when hitting the submit button.
Comment #6
Actron commentedCan I add debug output somewhere to provide you with further information or to see what code is reached? Any other ideas how I can solve my problem?
Comment #7
simon georges commentedI know that Mail log module exists, but as your problem is an absence of mail, I'm not completely sure it will be useful... The best way to trace what's happening would be using a debugger like XDebug...
Comment #8
Actron commentedCan't I just simply add echo() to the source files somewhere? I'm not that much into Drupal development yet.
Comment #9
simon georges commentedIt's normal that users don't show up in the subscription manager if they haven't confirmed.
But the mails should be sent... Could the mail be in the Spam folder of your client, by any chance?
Comment #10
Actron commentedOK, thanks for clarification about the subscription manager.
No, there are no spam filters involved (at least non that I know of). I also checked with different email addresses from various providers, but the problem is the same everywhere.
Does Simplenews use the same mailing mechanism for confirmation messages and test newsletters? So to say that when one of it works, the other should work, too? That's what confuses me right now, since everything works except for the confirmation mails.
Comment #11
Actron commentedOK, I think I figured out what's wrong. Attached you find some code that fixed the problem for me. You may use it to patch Simplenews 6.x-2.0 if you feel like this could be a general solution.
But let me explain what I did first: I added some debug output to the code that sends the test newsletters and that sends the subscription emails. Then I quickly realized that the test letter code (which worked) was different from the subscription one (which did not work). The test letter method uses mimemail to send emails, while the subscriptions are solely sent through the Drupal email backend.
As soon as I changed the code such, that subscription emails are send with mimemail as well (if module is installed), it worked for me. I guess the fallback mechanism (Drupals mail backend) will still not work on my server, but that seems to be related with the server environment. There was a message in the logs "Sender address rejected", because Drupal tried to send the email from wwwrun@domain.tld (where wwwrun is the webserver's user name) and that address did not exist.
Anyway, here is my patch: Open 'simplenews.module' and change the code that sends the subscription mails as following (remove the old call of drupal_mail() and replace it with the block of code that is marked with FIXME). The solution code was taken from the one Simplenews method that sends the test newsletters.
Hope that helps.
Comment #12
simon georges commentedComment #13
Actron commentedJust noticed that the same fix has to be applied to simplenews_unsubscribe_user() method for unsubscribe messages. The code is the same, except that 'subscribe' must be replaced with 'unsubscribe' when calling drupal_mail() (in if and else part).
Comment #14
simon georges commentedWould you be willing to submit a proper patch?
Comment #15
Actron commentedHaven't done that before. Attached you'll find a patch that I created with git. Hope that helps.
Comment #16
berdirHuh?
I can see that similar code already exists in simplenews and that's probably where you've copied it from, but this feels very weird to me.
Looking at mimemail.module 6.x-1.0 (from november, so quite new), it contains the drupal_mail_wrapper() function, which is defined like this:
Why can't we rely on that?
And if we really need to call mimemail() directly (what about other mail sending modules?), we should *at least* have our own api function to do this then instead of copy & pasting the code.
Comment #17
Actron commentedYeah, you are probably right about having a single function with that code.
Comment #18
Actron commentedRefactored. Please check if this works for you.
Comment #19
Actron commentedComment #20
simon georges commentedComment #21
Actron commentedIs there any progress in reviewing?
Comment #23
miro_dietikerClosing old support requests.