Plain text with/without attachment
Sutharsan - March 14, 2007 - 23:22
| Project: | Mime Mail |
| Version: | 6.x-1.0-alpha1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Sutharsan |
| Status: | needs review |
Description
Created the attached patch for adding attachments when plain text is selected.
| Attachment | Size |
|---|---|
| mimemail.inc_.plainattach.patch | 2.09 KB |

#1
I'm working on the cooperation between simplenews and mimemail. Further investigated the mimemail behaviour with plain text mails.
* Fixed bug in mimemail accepting the plain/html settings in newsletter, user mail preference and mimemail general settings. E-mails are now sent in plain text if any of the three is set to plain. (in mimemail.module)
* Mail body for mail with and without attachment corrected (in mimemail.inc).
#2
Southarson:
+1 the patch will allow attachment of files in newsletter which is a great feature.
@1 the patch was made to mimemail HEAD which isn't the best idea, IMO. I think if you tried patching a stable version of mimemail that will be great. I usually doubt the stability of HEAD, since it's where the developer commits changes thus it might be buggy.
Thanks for the great patch anyways.
#3
Here's an updated patch Mimemail version 1.0 patch which now handles correctly (hopefully without side-effects) the sending of plain text email with attachments *without* any HTML content.
Use this patch together with the updated Simplenews version 1.4 patch.
I also had to override the theme_mimemail_message function as follow (in template.php) :
function phptemplate_mimemail_message($body, $mailkey = null) {
return $body;
}
#4
Sutharsan,
I've commited the portion of this patch which allows for attachments when plain-text is selected.
If you could, please explain a bit further the other changes relating to user preference for plain text, and re-submit a patch just for that portion for review.
Thanks!!
Jer
#5
From reading my issue and the code I reconstruct the following:
* Whether or not to send plain text is determined by 3 parameters:
- Mime mail setting
- User setting
- Parameter in the mimemail() function call
If any of these is set to plain the mail should be plain
In the original code the user setting is ignored if mimemail()'s plain parameter is set (not NULL). My code is not good either, but I don't have the time now to rewrite. So I assign it to myself, but feel free to pick it up instead.
#6
Is this code submitted to 6.x as well? I notice a problem that html simplenews to the test email is sent with plain text content-type in the header. Could this be fixed too?
#7
@com2, make sure you use the latest 6.x-1.x-dev of simplenews. A number of fixes where committed last weeks in the html/plain handling.
#8
Sorry but the dev version of simplenews does not deliver at all in combination with mimemail. See this thread for information: http://drupal.org/node/153291#comment-1150871
#9
The latest 6.x version of the module sill has this problem. It sends out the html alternate content when the email is set to plain text and there is an attachment. I checked out the dev source code also and that too has this problem.
So what really happens is that when the user tries to send out plain text messages without HTML formatting the content gets squashed into one line because the mail has the HTML alternate part.
I was using the module along with simplenews module.
#10
We have prepared a patch to fix this issue for 6.x-1.0-alpha1 release. The same patch or the same strategy should work fine on the dev branch as well.