Send Mail in OpenERP with Mail Templates

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

Required module for Installation:

  • Email_templates
    First of all you need to configure outgoing email server.
    For Outing Mail Servers:
    Settings/Technical/Email/Outing Mail Servers

1111

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

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

If you success to configure Odoo (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

email_template_openerp

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.

dynamic_value_builder_mail_template_openerp

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:

advance_email_template_openerp

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_email_template_openerp

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:

2222

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

sale_order_send_mail_wizard_openerp

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s