Skip to Content
Menu
This question has been flagged
1 Reply
5269 Views

Good day

How to send an email without using a template?

I have done the following:


mail = self.env['mail.message']

mail_data = {'subject': subject,

                    'body_html': body,

                    'email_from': email_from,

                     'email_to': email_to}

mail_out = mail.create(mail_data)

mail.send(mail_out)


Kind Regards


Avatar
Discard
Best Answer

Hi Alan,

Please try like this.

vals = {
'subject': 'Foo',
'body_html': body,
'email_to': 'foo@example.com,bar@example.com',
'email_cc': 'qux@example.com',
'auto_delete': False,
'email_from': 'foobar@example.com',
}

mail_id = self.env['mail.mail'].sudo().create(vals)
mail_id.sudo().send()


Regards


Global Creative Concepts Tech Co Ltd.


Avatar
Discard