Odoo Help


How to send email by using odoo?

willie ho
on 8/19/15, 3:18 AM 629 views

I need to send email by a scheduler.

How do I do it when I have already set my email server?

Kalpana Hemnani
On 8/19/15, 9:32 AM

Hello willie ho,

If you want to send a static mail, can be directly sent by below steps:

def send_mail(self, cr, uid, context=None):

mail_body="""you can write any html tags and text here"""


'email_from': email_from,


'subject': 'Subject',

'body_html': mail_body


mail = self.pool.get('mail.mail').create(cr, uid, mail_vals, context=context)

self.pool.get('mail.mail').send(cr, uid, [mail], context=context)

After creating a scheduler method you have to create a scheduler xml record:

<record forcecreate="True" id="ir_cron_scheduler_action" model="ir.cron">

<field name="name">Scheduler</field>

<field eval="True" name="active"/>

<field name="user_id" ref="base.user_root"/>

<field name="interval_number">1</field>

<field name="interval_type">days</field>

<field name="numbercall">-1</field>

<field eval="False" name="doall"/>

<field eval="'model.model'" name="model"/><!--model in which method of scheduler is defined -->

<field eval="'send_mail'" name="function"/>

<field eval="'(True,)'" name="args"/>


Hope this helps.

Let me know if you want to know solution for sending mail using template!

Thanks and Regards,

Kalpana Hemnani

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: 8/19/15, 3:18 AM
Seen: 629 times
Last updated: 8/19/15, 9:32 AM