تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3 الردود
5560 أدوات العرض

hi, I want to send an email with a custom template 

but I can´t,. 

 I make a request from  a webpage form. 

my code is:

------->


mail_value = {'subject': 'Prueba ', 

'body_html': 'test',
'email_from': 'panchito@hotmail.com',
'email_to': 'juanito@outlook.com'}

request.env['mail.mail'].create(mail_value).send

return '---------------------------'+str('listo')

mail_value = {'subject': 'Prueba3', 

'auto_delete': 'False',
'body_html': 'test',
'email_from': 'panchito@hotmail.com',
'email_to': 'juanito @outlook.com'}

res = request.env['mail.mail'].create(mail_value)
template_id= request.env.ref('mymodule.template').id
template =request.env['mail.template'].browse(template_id)
template.send_mail(res.id, force_send=True)
return res

the first code  send the correct template to >>setting>>technical>>messages.

but it doesn´t go out of odoo, only it stay there even I clic send.    and my configuration of outcoming and incoming mail server is correctly......

the second code giveme the next error:

500: Internal Server Error


('El registro no existe o ha sido eliminado.\n\n(Registros: [154], Usuario: 10)', None




الصورة الرمزية
إهمال
الكاتب أفضل إجابة

thank you for your answers, this is my new code, and my new arrors 

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
مارس 15
9561
1
أبريل 16
8681
1
مارس 15
5399
1
يوليو 25
662
5
مايو 25
18094