This question has been flagged
1 Reply
2973 Views

Hi, on openerp61 we have the schedule_with_attach, to create and schedule a mail from code. Now this function dont exists more, (openerp7).

What function can use to schedule a mail from code or and action server (python code) now?

Thanks!

Avatar
Discard
Author Best Answer

Ok, with this code, I can send one email from one action server to automatic reply to a issue ticket.

email_to = object.email_from
mail_mail = self.pool.get('mail.mail')
asunto = 'TICKET %s EN CURSO' % (object.id) 
body = 'Estimado cliente, hemos recibido su solicitud de soporte %s.' % (object.id) 
body += '<br/>' 
body = 'En breve, uno de nuestros técnicos se pondrá en contacto con usted.'
body += '<br/>' 
body += 'Operación efectuada en fecha %s' % time.ctime() 
mail_ids = []
mail_ids.append(mail_mail.create(cr, uid, {
                    'email_from': "soporte@malagatic.es",
                    'email_to': email_to,
                    'subject': asunto,
                    'body_html': '<pre>%s</pre>' % body}, context=context))
mail_mail.send(cr, uid, mail_ids, context=context)
Avatar
Discard