Odoo Help


How to send email by using odoo?

willie ho
on 8/19/15, 3:18 AM 914 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

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