Closed (fixed)
Project:
Simplenews
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 Sep 2008 at 19:14 UTC
Updated:
11 Nov 2008 at 01:21 UTC
Jump to comment: Most recent file
Comments
Comment #1
Garrett Albright commentedDamn, botched the patch again. D.o crew, please give us the ability to edit our own issues already!
Comment #2
sutharsan commentedThis patch fully bypasses simplenews_mail() which is not good. Newsletter title and unsubscribe messages will be removed and outgoing messages not cached.
Comment #3
Garrett Albright commentedIt calls drupal_mail() with the $module paramater set to 'simplenews', which, unless I'm missing something, will call simplenews_mail(). So it should call simplenews_mail() the same way that the unpatched code does.
Speaking of which, I forgot a rather important perimeter in the call to drupal_mail() for when test newsletters are sent. New patch!
Comment #4
sutharsan commentedThe mime mail version you mention in the original text does not call drupal_mail().
Read the code of drupal_mail() to see how it works. It is substantially different from D5.
An other important thing you overlooked is that your patch does not use the Simplenews mail spooler and the patch does not work properly with cron.
Comment #5
luti commentedI've tested the above #3 patch (simplenews-mimemail_1.patch), applied to the September 2nd dev version. It seems to work good (tested just sending a test message, not more up to now...) - message seems to be properly formatted (HTML), while there is no need to have mimemail option to process all messages selected anymore (as before, without that patch).
Comment #6
thomas23@drupal.org commentedsubscribe
Comment #7
Garrett Albright commentedSutharsan… wha?
No, Mime Mail doesn't call drupal_mail() (that I know of), but the code in the patch for Simplenews does. Have you looked at it? Its call to drupal_mail() is identical to the unpatched code's call, save for the $send parameter being set to FALSE.
And having actually used this bit of code, I assure you that it does indeed spool messages and send on cron runs.
Are we looking at two different bits of code or something?
Comment #8
madaerodog commenteda little help here ... how do you apply the patch ... I found simplenews.module ... but how do I replace and what?
Comment #9
sutharsan commented@Garret: sorry, I misread the patch. Your approach is the right one.
Some minor remarks:
* Should non-HTML newsletters go through mimemail or not? Perhaps for the sake of SMTP compatibility.
* Don't use the 'Test newsletter sent via Mime Mial ...' message but use the 'Test newsletter sent to ...' message instead. We don't want to bother the average user with the techy 'via Mime Mial' info.
Thanks for the work, and sorry for the confusion.
@madaerodog: see http://drupal.org/patch for all information on patching.
Comment #10
keuvain33 commentedHello
I have two major problems with this Mimemail version.
Firstable, I send two newsletters and one of its don't working correctly but the other is perfect.
And my second bug is a problem about spam. When I received a mail sent by simplenews. Thundirbird reconize it as a spam and I don't know how I can fix it.
Thanks in advance
Comment #11
Garrett Albright commentedkeuvain:
Without more information, it is impossible to diagnose your first issue.
As for the second one, this page has some helpful info on how to help avoid having your newsletters flagged as spam. (Of course, they won't do much good if your "newsletters" really are spam…)
Comment #12
keuvain33 commentedThanks for your answer. Now it's working perfectly. But mimemail send 2 mail one in HTML and one in plain text. So everybody receveid 2 mails. How can I do to resolve this problem?
Comment #13
Garrett Albright commentedI haven't had that problem personally, so I can't help you there.
Comment #14
Garrett Albright commentedOkay, here's an updated patch. Note that this patch is against the unpatched version of simplenews.module, not against a version patched with my earlier patch; you should redownload the dev version of Simplenews if you don't have the unpatched version anymore.
Changes:
A lingering problem is that text in the footer of the message is not being properly HTML-to-text'd. For example, the "click here to unsubscribe" link does not indicate a URL to access to unsubscribe.
Comment #15
Liberation commentedI've been able to get the patch in the preceding comment working correctly for HTML mails in the test send scenario. However, for the bulk send scenario the sent emails have a subject prefix of "[Unassigned newsletter]". On debugging simplenews_mail() I found around line 1449 code of the form $tid = $node->simplenews['tid'] but in this case $node->simplenews had value false i.e. was not initialised. Basically, it can't determine the taxonomy (which is correct in the database AFAICS). Any clues to what's going on?
Comment #16
Liberation commentedThere's a minor change required round about line 1618 when simplenews_debug is enabled. There's a call to watchdog() where it's calling the t() function for the error message argument. This is not correct and results in a PHP error when the log entry is viewed in the View Recent Entries log report. There is another call to watchdog() seven lines later which has the correct code. In summary:
change:
Comment #17
Garrett Albright commentedLiberation: With regards to the "[Unassigned newsletter]" problem, have you made sure to assign the node to a newsletter before you sent it?
Comment #18
Liberation commentedGarrett, I didn't change anything on the user interface other than select a different radio button for the send option. The newsletter category was assigned and appeared fine on the screen, and as I say it worked correctly when in test send mode, it just didn't work properly in live send mode.
FWIW, I also had to select the 'html' option in the send panel both times, as this doesn't seem to be a persistent setting (is this deliberate to always revert to 'plain').
Comment #19
Garrett Albright commentedLiberation, not sure what to tell you about the first issue, but as for the second one, here's a fix.
…And here's a patch against the latest dev release which implements that patch as well as all the other ones, against the most recent dev release. I'm kind of disappointed to see that none of my patches have been implemented, not even the ones not related to Mime Mail.
Comment #20
sutharsan commentedGarrett, have faith ;) I follow your patches closely and will commit when I have the time to go through then in detail. However you making things more complicated now by mixing this issue with #308721. There are several differences between #14 and #19 patch, please keep your patches clean. What is the purpose of
$node->is_mail = TRUE;?Comment #21
Garrett Albright commentedWell, that's my own little hack that snuck into the patch - it can be omitted. In the custom module I'm developing, in hook_nodeapi() with $op === 'view', I put the rendered node in an iframe when $node->is_mail is unset or false. But I don't want that iframe to be there when the node is being emailed.
If you decide to omit that part of the patch, though, I would encourage you to consider putting a variable somewhere which will tell us if the node is being sent "now" - perhaps something like $node->simplenews['sending_now'] would be a better place. Being able to alter a node "downstream" depending on whether it's about to be mailed or not will make life easier. (Perhaps such a variable already exists and I just haven't found it yet?)
As for why I made #308721: Format default not respected a separate issue, it's because it is - it is independent of these hacks. Even if you reject the patches I'm offering in this issue, the patches in the other issues can still be of use to you (I hope).
Comment #22
sutharsan commentedIf you want to keep these issues separate (as I would recommend) than please do not mix them as you did in #19.
I have considered creating a hook call (e.g. hook_simplenews_mail_alter() ) in simplenews_mail() enabling other modules to alter the content of the outgoing email. Perhaps that could be of help to you. Or perhaps you can use the hook_mail_alter() to do the same.
Comment #23
Liberation commentedHaving updated the HEAD + #19, things are looking good so many thanks to all involved.
One relatively minor point for consideration: in theme_simplenews_newsletter_body() at around line 2174 in patched simplenews.module, we find the line:
My html emails have a special graphics banner header, and having the title text stuck on the front interferes with it so I've had to comment this line out. I don't really think the title should be added, the user should have full control of the content via the Edit form in my view.
An acceptable workaround if you insist on adding the title is that the h2 tag should have a class="newsletter-title" or suchlike (not a tag as this could not necessarily be unique if two newsletter teasers were displayed on the same page). Given a distinct class specifier, I should be able to hide it with CSS display:none.
Another option would be to allow the body effectively to be a template, and say substitute the $title where some magic string like {title} appeared in the body text.
Comment #24
sutharsan commentedThis is not about restoring mime mail support. Please create a different issue.
Regarding your subject, please read the handbook on theming.
Comment #25
sutharsan commented@Garret: I started working off #14.
Can you explain why you use the code below in calling mimemail().
When the newsletter format is 'plain' simplenews_mail() already takes care of formatting the body as plain text. Why do it again here?
Comment #26
sutharsan commentedAttached patch is committed to HEAD. It will be rolled back onto 6.x when the related code of mime mail is stable enough. I want to keep ordinary users from running into compatibility problems between the two modules. With your help I will keep Simplenews HEAD compatible with Mime Mail HEAD. Thanks so far!
Comment #27
Garrett Albright commentedSutharsan: I can't recall my reasoning for the line in #25. Perhaps it's not necessary.
I've had to put my project which uses Simplenews/Mime Mail support aside for the time being, but once I get back into it, I anticipate playing with the new "official" releases.
Comment #28
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #29
allartk commentedI found one small mistake in patch 26. The 7th argument given when calling mimemail (arround line 1380) contains html, it should be plaintext or empty. If empty mimemail generates the plaintext itself from the html body given as 4th arg.
This results in having html tags in the plain text part of the email.
I've not much experience in making patches , so if someone else can correct this..
Comment #30
Garrett Albright commentedYeah, it turns out the line Sutharsan points out in #25 is actually quite important after all…
Comment #31
samuelet commentedI racked my brain to understand why i was not able to send plaintext mail and finally i found this closed issue.
In the current 6.x release the mistake pointed out in #26 can be considered a bug because it prevents html tags to be cleaned in the plaintext format.
I did not tested if HEAD works also without it, so i attached only the fix for 6.x
Comment #32
sutharsan commentedThanks.
Committed to 6.x-1.x-dev and HEAD
Comment #33
samuelet commentedAfter further inspection i have to say that #25 is right but #26 does not work because of a mimemail bug: #319562: Multi-part message in MIME format wrong plain text format (don't know why it was closed).
So with #26 the bug happens only when the simplenews html format option is selected.
Comment #34
samuelet commentedsorry, wrong assumption: mimemail needs the plaintext content as parameter for multipart mail.
Forget my previous comment.
Comment #35
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.