Send Mail in OpenERP with Mail Templates

Hello

    Now a days Mailing mechanism is to fast for any communication. Here I would like to serve you how to send mail in openerp and how to use a custom templates for sending mail.

Required module for Installation:

--> email_templates
    Here First of all you need to configure outgoing email server.
    For Outing Mail Servers:
        Settings/Technical/Email/Outing Mail Servers











Google:
    smtp.gmail.com
    SSL Port 465
    StartTLS Port 587

Yahoo:
    smtp.mail.yahoo.com
    SSL Port 465



If you success to configure openerp outgoing email server then lets see how to use a custom templates for sending mail.

Here First of all you need to install email_template module.This module is used to specify the format in which the email has to be send.


For Templates:
      Settings/Technical/Email/Templates





















In templates need to set required field

Name : Name of the template
Applies to: Model to which the template is related [Ex: sale order]
Form: sender address
To: Destination mail address
Reply To : Preferred Reply address
Subject : Subject of the mail
Body : Body of the email [either plain text or an HTML format]
Add signature: predefine signature for all.


Main important feature of email_templates is dynamically value builder tab where you can fetch your required field from related document model and also use the field value in [Form,TO,Subject,Body] anywhere in mail template.

















Field Description:

Field : Select field from Applies to model
    In our Example:we select sale order modele in applies to so all sale order filed display here like [name, ref, company_id, partner_id, etc]

Sub-Model : When a relation field like many2one is selected, this field specify the Related model.
       Example: partner_id is many2one field which related with res.partner
   
Sub-field : When a relation field is selected, this field let us select the target field inside the Sub-Model
        Ex: In sub-model if you select partner_id than you can use all partner table field as sub field

Placeholder Expression : This is the resulting expression generated when the fields are selected in Dynamic Value Builder. This can be copy pasted in fields in email template.
      ex: ${object.partner_id.email}


In Advanced tab you can find this many field:








 








Language: language of the mail
Outgoing mail server: Outgoing Mail Server configured before
Auto Delete : Permanently delete the email after sending it to save space
Attachment: to attach files on email.




Button events:


Preview: preview of mail_template
  Add context action: this creates a links in [more] in the related document model form view which helps in sending email any time from the form view.
    example: I have created a template for the sale.order and a link is created by clicking "Add Context action" button in template, a link will be created as shown below screen-shot:



















When you click on this link, a wizard pops up using from which we can send email to clicking send button:
















Thanks,

Mayur Maheshwari

48 comments:

  1. Thanks for the great overview.

    I have a specific challenge: I would like e-mail an OpenERP (V7) invoice to a customer so that he can import that into his own OpenERP. The V6-documentation describes a functionality in the portal ("EDI panel") where the customer can choose to import the document into his own OpenERP.

    But in my OpenERP V7, the template "Invoice - Send by Email (Portal)" only provides a link to "access the invoice document and pay online via our Customer Portal" - not download it. And the link takes the customer to a portal without the "EDI panel".

    Where could I find the e-mail template that would enable the customer to import the document into his own OpenERP?

    Or can the EDI panel feature be activated with some configuration or setting in the standard OpenERP? I have been looking around, but haven't been able to find a solution.

    Any help is greatly appreciated!

    ReplyDelete
    Replies
    1. Mayur Maheshwari - Techno-Functional Consultant Odoo (Openerp): Send Mail In Openerp With Mail Templates >>>>> Download Now

      >>>>> Download Full

      Mayur Maheshwari - Techno-Functional Consultant Odoo (Openerp): Send Mail In Openerp With Mail Templates >>>>> Download LINK

      >>>>> Download Now

      Mayur Maheshwari - Techno-Functional Consultant Odoo (Openerp): Send Mail In Openerp With Mail Templates >>>>> Download Full

      >>>>> Download LINK sL

      Delete
  2. Can we do the same for webkit reports too? For example webkit partner ledger.

    ReplyDelete
    Replies
    1. Any answer to my question? Anyone?

      Delete
    2. Not getting you . can you elaborate more ?

      Delete
    3. I asked that can we create an email template for partner_ledger webkit that is sent to each partner automatically to their email ids and the report attached as partner's name.pdf?

      Delete
    4. Yes you can ! You need to create one scheduler and write python code in server action so it will call email template and also execute automatically on basis of scheduler action.

      Delete
  3. The email contains the fieldnames and not the content. Do you have any ideas how to solve that?

    ReplyDelete
    Replies
    1. Email templates contains a field names that's feature or we can say it's beauty of email template we can customize it with any fields which are including in our object as we want in our email template. Once email is send it will display the whole value of of all related fields in that email.

      Delete
    2. Thank you Mayur. This works!

      Delete
  4. Includes the fields using the Dynamic Value Builder, but when I open the template through the button that was the object-inclusive, it presents the fields that insert using the Dynamic Value Builder. So if I put the field ${object.company_id.name}, he does not have the value that it brings within the object but the field declaration.

    Can someone help me please? thank you

    ReplyDelete
  5. Hello,
    Followed above steps for my module latest_base. However system displays following error

    AttributeError: 'latest_base' object has no attribute 'message_post'

    Any idea to fix this issue.. Thanks

    ReplyDelete
    Replies
    1. In Your Module latest_base you missed to add inherit mail.thread object .
      Add it and check it again.
      _inherit = ['mail.thread']

      Delete
    2. Thanks Mayur . Can you help me on this requirement ?

      System should pops up message saying that " Mail has been sent OR Mail couldn't send at this point of time

      Delete
    3. Yes need some customization contact me on : mayurmaheshwari07@gmail.com

      Delete
    4. Thank you. Mayur Mahesh. I sent an email to you with my requirement

      Delete
  6. This comment has been removed by the author.

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. As per the above steps i have configured the email template.But in the body of the content is not displaying during receiving mail .Kindly guide me to solve this issue.

    ReplyDelete
    Replies
    1. Check your mail template , Just make sure all fields you are accessing through the dynamic view builder is there in your model , if you find any fields wrong then it will not showing your template in mail body :

      Thanks,
      Mayur Maheeshwari
      OpenERP/Odoo
      Skype: mayur_maheshwari1

      Delete
  9. Hi.

    I want to create a Email Template Using Python Script.

    How Can I Create That?

    ReplyDelete
    Replies
    1. Odoo Office 365 mails has many benifits such as:

      1.Manageable through a single console along with other Ksolves Office 365 apps
      2.Makes use of powerful features of Office 365 Base
      3.Sync email based on the number of days assigned
      4.Advanced search and filter mechanisms for logs analysis.
      5.Separate views for the previously sent or inbox mail

      Delete
  10. I want to pass an html string to a template and use that in that template. Infact what i need is to display a previously sent mail's body from mail.message and display in new mail. I have achieved that, but my html syntax is not rendered but shown as the source code itself. What should i do?

    ReplyDelete
    Replies
    1. Send me your mail template i think if you did any mistake while creating template then it will showing you source code. verify your source code or send to me i will check from my side : you can reach me for OpenERP mail template on this gmail : mayurmaheshwari07@gmail.com or skype :- mayur_maheshwari1

      Delete
  11. I only can send email from admin account, if i connect with other user with all permissions, the email is never sent

    ReplyDelete
    Replies
    1. Please check users access rights is given properly or not ?

      Delete
  12. Hi,,

    Can you please tell me programmatically , which API should we use to achieve "Send By Email" functionality ?

    ReplyDelete
  13. HI,
    May I know how to add CC(email_cc) and Bcc(email_bcc) fields in odoo8 email template.

    It is available in OpenERP6.1 but I could not see these fields label in Odoo8.

    Can anyone help me?

    ReplyDelete
  14. Hello,

    can you please tell me how to set amount_total value precision in last two digit like 5.00.

    ReplyDelete
    Replies
    1. HI Parikshit,
      If you creating a new fields then set a decimal_precision in your fields and then set a decimal precision digit 2 from Settings/Technical/Database Structure/Decimal Accuracy. if this fields is allredy exits then check decimal precision and apply 2 digit on it. Hope it Helps

      Delete
  15. Hello, can I add multiple recipient email from my customer? I'm trying to figure it out, but still can't make it. Any suggestion?

    ReplyDelete
    Replies
    1. You can add multiple recipients by this way. ie)'x@gmail.com,y@gmail.com,z@gmail.com'

      Delete
  16. Thank you for the information, I think this article is very useful for all who read it.
    .

    ReplyDelete
  17. This comment has been removed by the author.

    ReplyDelete
  18. HI,
    May I know how to add Bcc(email_bcc) fields in odoo7 email template.

    Can anyone help me?

    ReplyDelete
  19. Its a great pleasure reading your post.Its full of information I am looking for and I love to post a comment that "The content of your post is awesome" Great work.
    free newsletter templates

    ReplyDelete
  20. Oswaldo Alarcon24 March 2017 at 22:33

    Hello Mayur, I´m using Odoo V10 on AWS and I´m trying to send invoice by the email template but it is failing with the following message:
    "Fail the process of the tempale using the values {'format_tz: at 0x7efc4687fc80>, 'ctx': {u'uid': 1, 'button_access': {'url':'/mail/view?message_id=17273, ..... etc. etc.

    Could you please help to solve this issue. Thank you in advance.

    ReplyDelete
    Replies
    1. HI,
      Are you rendering date field in your invoice template ? or format_tz to render date. then try to render datetime field by below ${format_tz(object.invoice_date+ ' 00:00:00', format= '%d/%b/%Y')}
      Hope it works for you.

      Delete
    2. Oswaldo Alarcon25 March 2017 at 22:45

      Hi Mayur, thank you for your prompt response. I'm using original system and I've not change anything, probably the original image comes with this error. Where can I get this sentence or definition you are talking about. Thanks.

      Delete
  21. Hi Mayur,
    I am trying to implement send message in ios app but It seems not working. Can you help me to findout the issue? here is my problem description..

    http://stackoverflow.com/questions/43292451/how-to-send-message-programatically-from-odoo-using-xmlrpc

    ReplyDelete
  22. Ksolves Office 365 Mails Connector makes your life a lot simpler by enabling Odoo CRM Email Integration. It lets you choose through a simple click to sync mails from Outlook to Odoo. Combined with Ksolves Office 365 Base features, it provides a way to comprehensively Odoo email configuration from Office 365 to Odoo. You can buy best Odoo Office 365 Email Integration App at Ksolves Store.

    ReplyDelete
  23. Work with all the applications that you have been using all these years, along with the benefits of the smart integration features. Streamline all your office tasks and business processes efficiently and conveniently by integrating them with Odoo Office 365. Get the best-in-class productivity by the two-way connection between people and information.

    ReplyDelete
  24. Mayur Maheshwari - Techno-Functional Consultant Odoo (Openerp): Send Mail In Openerp With Mail Templates >>>>> Download Now

    >>>>> Download Full

    Mayur Maheshwari - Techno-Functional Consultant Odoo (Openerp): Send Mail In Openerp With Mail Templates >>>>> Download LINK

    >>>>> Download Now

    Mayur Maheshwari - Techno-Functional Consultant Odoo (Openerp): Send Mail In Openerp With Mail Templates >>>>> Download Full

    >>>>> Download LINK C0

    ReplyDelete
  25. Really good work there. Informative and helpful. Appreciate it. But might be looking for Odoo ERP Development in Pennsylvania

    ReplyDelete
  26. Thanks for sharing for the nice blog. You made this beneficial with your skill and talent. You also can share some suggestions on Odoo Erp System.

    ReplyDelete