user11572603
user11572603

Reputation:

How can create and send a mail by python code without creating a mail template in xml in odoo

Is it possible to send an email without a mail template ? I need to send an email from python code without creating the mail template by xml.

Upvotes: 2

Views: 281

Answers (1)

Ajmal JK
Ajmal JK

Reputation: 833

Yes it is possible.You can pass the email values within the python code itself.

values = {}
email_to = 'receiver mail id'
email_from = 'sender mail id'
values['email_to'] = email_to
values['email_from'] = email_from  // Not necessary
values['subject'] = YOUR MAIL SUBJECT
values['body'] = You Email Body
self.env['mail.mail'].sudo().create(values).send() // Creating and sendimg the mail.

Upvotes: 3

Related Questions