Odoo Help


Trying to send mail to myself in localhost in create - But it Fails every time [Closed]

Mostafa Mohamed Abdel Monaem
on 12/9/15, 9:56 AM 722 views

The Question has been closed

Ermin Trevisan
on 12/10/2015 08:38:30

Hi there.

i'm trying to send mail to myself in localhost when an invoice has been created but everytime it fails

the maill created successfully and recorded in the database and every thing is fine but why i can't get the mail in my inbox ?

could i have some help here

Here is my code : 


@api.returns('self', lambda value: value.id)

def create(self, vals):

invoice = super(exppen_invoice, self).create(vals)

for res in invoice:

body = """



<title>Inform of Invoice Creation</title>



<h1>Invoice Has been created</h1>



There is an invoice has been created in

""" + str(res.date_invoice)

body += """;&amp with code ;&amp""" + str(res.bodes)

body += """<br/>and you can find this invoice<a href="/web#id=""" + str(res.id)

body += """&view_type=form&model=account.invoice&action=278>;&amp Here ;&amp</a>





mail_msg_gets = {

"type": "notification",

'email_from': "LiveConnect System <apps@net2do.com>",

'reply_to': "LiveConnect <support@net2do.com>",

"author_id": 1,

'partner_ids': [(6, 0, [res.partner_id.id])],

'model': 'account.invoice',

'res_id': self.id,

'record_name': 'Created Invoices',

'body': body,


mail_message_id = self.env['mail.message'].create(mail_msg_gets)

mail_mail_gets = {

"mail_message_id": mail_message_id.id,

'subject': 'Created Invoices',

'notification': True,

'auto_delete': False,

'model': 'account.invoice',

'res_id': self.id,

"state": 'sent',

'email_to': res.partner_id.email,

'body_html': body,


print("mail_mail_vals : ",mail_mail_gets)

mail_mail_id = self.env['mail.mail'].create(mail_mail_gets)


return invoice

Can you send mails from the backend UI? Any log entries?

Ermin Trevisan
on 12/9/15, 10:42 AM

did you checked the e-mail queue and outgoing e-mail status?

Baiju KS
on 12/9/15, 10:44 AM

it's not working for me as well, I need to add a different/separte email to get the mail to the smtp on localhost

Peter Niederlag
on 12/9/15, 1:07 PM

Why is it so hard to provide the necessary information in order to get help? Do we have a crystal ball to look into your system????

Ermin Trevisan
on 12/10/15, 2:12 AM

i don't know what is the configs needed but i didn't do any conf at all? is there is an configs that i should add in order to get it work ?

Mostafa Mohamed Abdel Monaem
on 12/10/15, 3:07 AM

Ermin Trevisan

--Ermin Trevisan--
| 6 5 7
Walchwil, Switzerland
--Ermin Trevisan--

Ermin Trevisan
On 12/10/15, 8:37 AM

First study how to set up the email system properly. Then try to send an email from the user interface. If it works, try your code again. If you still have errors, post your question with all necessary details, especially with the corresponding log entries.

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: 12/9/15, 9:56 AM
Seen: 722 times
Last updated: 12/10/15, 8:38 AM