[TRUNK][WISH] bin/tools/misc.py def email_send, add parameter for attachment mime type for ICS file

Bug #675617 reported by Serge
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Won't Fix
Wishlist
Unassigned

Bug Description

IN bin/tools/misc.py
def email_send

if attach:
        msg.attach(email_text)
        for (fname,fcontent) in attach:
            part = MIMEBase('application', "octet-stream")

Add parameter for 'application' and 'octet-stream'

Why : we need send ics file by email, but with application and octet-stream, mail program don't detect is a calendar file, for the moment i create a new function with 'text','calendar', with this modification, gmail automatically detect the attachment is a calendar event and ask to add to google calendar.

Thank

Serge (sboivin)
summary: - [WISH] bin/tools/misc.py def email_send, add parameter for attachment
- mime type for ICS file
+ [TRUNK][WISH] bin/tools/misc.py def email_send, add parameter for
+ attachment mime type for ICS file
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Hello Serge,

This is a sensible suggestion, however we can't introduce this change at this stage of the preparation of the final v6.0 release (because it requires a change of the API of email_send since the attachments would need to be passed differently)
Your workaround is to implement a variant of email_send indeed.

We'll keep this suggestion in mind for post-v6 release, thanks!

Changed in openobject-server:
importance: Undecided → Wishlist
status: New → Won't Fix
Revision history for this message
Serge (sboivin) wrote :

Humm no sure i understand what you say, because i do it with low change

add 2 optional parameter mimy_type and mime_obj

def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=None, reply_to=False,
               attach=None, openobject_id=False, ssl=False, debug=False, subtype='plain', x_headers=None, priority='3',mime_type='application',mime_obj='octet-stream'):

....
replace this line
part = MIMEBase('application', "octet-stream")
By
part = MIMEBase(mime_type, mime_obj)

nothing else need to be change, when i call the function i pass 'text' and 'calendar' and all work fine

So i dont understand why you say you need to pass attachment differently, only need to change the mime,

Anyway is not important because i duplicate the function and change it in our module.

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.