← Back to team overview

c2c-oerpscenario team mailing list archive

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

 

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.

-- 
[TRUNK][WISH] bin/tools/misc.py  def email_send, add parameter for attachment mime type for ICS file
https://bugs.launchpad.net/bugs/675617
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.

Status in OpenObject Server: Won't Fix

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





References