Odoo Help


how to send email?

aneesh ATEES Infomedia Pvt Ltd
on 2/11/15, 10:46 PM 787 views

how to send email when i click on the button?

Umashankar Subramani
On 2/12/15, 12:32 AM

Hi aneesh,


1.Create a template for your email ,settings->email->template-> create -> Name-User defined, Applies to- description to model, model- model for creating email, and you can give acces rights, on the content tab you need create the template. In email configuration you need to configure your email address for sender and receiver. And in advanced setting you have an option that you can add a attachment automatically by giving the optional report to print or attach and save the template.

2.You need to create the button with type="object", which the respective method where you have to configure your email.

3.In your model , you need get the template for eg 

        email= self.pool.get('email.template')
        template_id=email.search(cr,uid,[('model_id.model', '=','hello.world')]) 

so using this template you need to compose the email and return        

       ir_model_data = self.pool.get('ir.model.data')
            compose_form_id = ir_model_data.get_object_reference(cr, uid, 'mail', 'email_compose_message_wizard_form')[1]
        except ValueError:
            compose_form_id = False 
        ctx = dict(context)
                'default_model': 'hello.world',
                'default_res_id': ids[0],
                'default_use_template': bool(template_id),
                'default_template_id': template_id[0],
                'default_composition_mode': 'comment',
                'mark_so_as_sent': True

       return {
                'type': 'ir.actions.act_window',
                'view_type': 'form',
                'view_mode': 'form',
                'res_model': 'mail.compose.message',
                'views': [(compose_form_id, 'form')],
                'view_id': compose_form_id,
                'target': 'new',
                'context': ctx,

Try this.........

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 2/11/15, 10:46 PM
Seen: 787 times
Last updated: 9/16/15, 7:45 AM