The attached patch allows the sending of attachments with the newsletter issues using the upload module. The patch needs the upload module to have less weight than simplenews to work properly.

Comments

sutharsan’s picture

Has this patch been tested with mimemail?
I can not get it working with :
* simplenews.module,v 1.56 2007/02/20
* mimemail.module,v 1.14.2.1 2007/01/05
* mimemail.inc,v 1.18.2.1 2007/01/05
Up till now I have found that the boundary declaration (boundary="OC-120320074453-CO") is missing in the mail while it is there in the patch.

BooDy’s picture

Actually the patch was tested with mimemail.module disabled.

pal_ur’s picture

It seems neither with 5.x-1.0, nor with 5.x-1.1 to work... Could anybody help?

Thx.

BooDy’s picture

pal_ur
The patch applies fine with 5.x-1.1. Did you give the upload module less weight than simplenews in drupal's system database table?

pal_ur’s picture

Yes. I gave upload module weight "-5", the simplenews module has "0". I send a test message, wich is sent out, but the attachement is in the body of the letter. It looks like this:
--OC-140320072308-CO ------------TEST LETTER TO FIND OUT HOW TO ATTACH------------ Test message body -- -- Footer will be appended here --OC-140320072308-CO Content-Type: image/jpeg; name="virag.jpg"; Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="pic.jpg"
After (and only after) the filename is a linebreak, and then begins the encoded (?) attachement in the body of the message, ot attached.

pal_ur’s picture

Sorry, a little misspelling...

--OC-140320072308-CO ------------TEST LETTER TO FIND OUT HOW TO ATTACH------------ Test message body -- -- Footer will be appended here --OC-140320072308-CO Content-Type: image/jpeg; name="virag.jpg"; Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="virag.jpg"

sutharsan’s picture

StatusFileSize
new5.98 KB

Using the strength of mimemail to handle ... mime mail, I made this patch to handle attachments for both html and plain newsletters.
Use this patch together with this mimemail patch.
* All node attachments are send with the newsletter. The List setting is ignored.
* Mimemail is required when sending newsletters with attachment. Without mimemail the attachment is ignored. (TODO: needs documentation)
* Module weight is set at installing the module (simplenews.install) (TODO: increase weight at upgrade)

pal_ur’s picture

Fine, works. Thanks a lot.

owahab’s picture

Status: Needs review » Needs work

The original patch by BooDy works perfect with mimemail module diabled.
Simply, BooDy's patch sets some mail headers to attach content to the node. When mimemail is enabled, simplenews sends the e-mail via memail which in turn overrides the headers thus the attachment appears in the body.
Disabling mimemail made this patch work fine.
I do not think I'd go for BooDy's patch rather than Sutharsan because I will need to patch one module not two.
Extra fine BooDy. ;)

davemybes’s picture

It looks like the latest version of Simplenews (May 8, 2007) has file attachment support built-in now. Simply activate the upload module, and allow attachments for newsletters. You must also activate the mimemail module, and set the newsletter to HTML format. This works nicely on my system.

davemybes’s picture

Status: Needs work » Active
jun’s picture

Version: 5.x-1.0 » 5.x-1.4
Status: Active » Needs review
StatusFileSize
new4.72 KB

This is my first patch, needed to send newsletters in plain text with attachments.

Here's an updated patch for Simplenews version 1.4
Use this patch together with the updated 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.

I also had to override the theme_mimemail_message function as follow (in template.php) :

function phptemplate_mimemail_message($body, $mailkey = null) {
return $body;
}

wkamm’s picture

There are a number of patches attached to this thread, and I'm sure one of them will help me, but I'm not sure which one to use.

I am running Drupal 5.5, SimpleNews 5.x-1.4, mimemail 5.x-1.0, with the Upload module enabled.

When I send an email via SimpleNews, with attachments, in HTML format, it looks fine. The "attachment and sizes table" displays properly in the received email. The column headings are there, and the attachment names and file sizes show. I can click on the attachment name to view the file. Everything is good.

However, when I send an email in plain format (i.e. not HTML), the email looks something like this:

--------------------------------

7:36 PM 8/25/2008

strtoupper(" Attachment
")strtoupper(" Size
")

1101061218_120.jpg [ http://mysite.com/files/image.jpg ]
10.05 KB

--------------------------------

Can anybody help me understand which of these patches can fix this problem? Thanks,

Bill

Wurlitzer’s picture

wkamm, did you resolve this issue? I'm having the same problem....

caillou’s picture

Yes, same problem too

tax’s picture

I'm trying to figure out on how to apply the Boody's patch, but i can't find anything: could someone kindly explain how to apply it ? Or, at least, point me in the right direction ? Thanks.

davemybes’s picture

sutharsan’s picture

Status: Needs review » Closed (won't fix)

By now, I don't add new features to the 5.x branch any more. 6.x does support attachments.

armyofda12mnkeys’s picture

Issue summary: View changes

just an FYI since this is only link if you google 'simplenews attachments'...
You can get attachments in a SimpleNews newsletter by adding a File field to the Simplenews Content Type so user can pick a file to attach (can also use the Media module and use its WYSIWYG selector to pick the file in the file system vs always uploading a new file).