New feature: sending Files as email attachments

Bug #682675 reported by Balazs Ree
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Singing & Dancing
New
Wishlist
Unassigned

Bug Description

Hi,

I need to support a use case where a File is sent out as a newsletter, in favor of a client of mine.

In my use case, only Files of mimetype application/pdf need to be supported this way. I need the (pdf) sent out as an attachment to the email (and not as a link in the email pointing to the file).

I am willing to do this development. My question is: has any work been done in this direction, that I can reuse?

Another question: is this a desired function in the core release? Meaning, can it get to accepted and released soon, if I develop it? (Or, should I rather do the development in a separate custom product, and hook in the code via zcml / monkeys, in which case it won't get into SnD?)

Best,

Balazs Ree

Revision history for this message
Daniel Widerin (saily) wrote :

Hi,

S&D uses the email parser module to generate multipart emails. you can add attachments to the header as described here:
http://docs.python.org/library/email.message.html#email.message.Message.add_header

The responsible S&D function which creates the html mail is 'create_html_mail' in:
https://svn.plone.org/svn/collective/collective.singing/trunk/collective/singing/mail.py

I'm unsure your usecase is supported by default, but it shouldn't be very hard to implement. i would recommend you add a branch in collective where you checkin your code, so we could have a look at it and maybe reuse some code.

so +1 for adding this file attachment support :-)

daniel

Changed in singing-dancing:
importance: Undecided → Wishlist
Revision history for this message
Daniel Nouri (daniel.nouri) wrote :

Balazs,

+1 to adding this to the core. I wonder how we could make this work meaningfully for people TTW.

Revision history for this message
Balazs Ree (ree) wrote :

Thanks for the link to the relevant code part.

I believe that sending the attachment itself is not a hard task indeed.

To Daniel Nouri: What problems do you identify for making this work TTW? Do you mean anything in specific?

The following is what I see, but I have not started the actual work yet.

- We need to assure that the "Send as Newsletter" is working correctly on File objects, meaning: users can select a single file and send it out.

- As in this case the file will be sent as an attachment, we also need some text appear in the beginning of the email. I think that this should be settable per newsletter as the user wishes, so some UI is needed for that (maybe, in the customize channel page, or maybe a link from the customize channel page to a Document object that comes with a default content that they can edit).

- The unsubscribe link should be at the bottom as usual.

Do you have something more in your mind?

Revision history for this message
Daniel Nouri (daniel.nouri) wrote :

Sorry for the late reply, Balazs.

I was assuming that you wanted to add a file upload to "Send as Newsletter", to allow an uploaded file to be send along as an attachment. This way around, you would already have your text in the beginning.

Alternatively, I think we could add something like the reference browser widget on the "Send as Newsletter" form, which would allow to add multiple items from the site to send. The API for sending multiple items in a newsletter is already there (it's what the automatic newsletter-from-collection set-up uses).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.