Sending Emails from OpenERP Using the Module 'smtpclient'

    OpenERP has many methods and modules to handle the emailing functionality flexibly. One among them is the module named ‘smtpclient’. Once the module is installed the following menus are created .

 

Menus
Administration/Configuration/Sendmail Services
Administration/Configuration/Sendmail Services/SMTP Servers
Administration/Configuration/Sendmail Services/SMTP Servers/Message Queue
Administration/Configuration/Sendmail Services/SMTP Servers/Sent Email History

    We start the configuration steps from the menu “Administration/Configuration/Sendmail Services/SMTP Servers”. An SMTP server allows a user to send emails from OpenERP using his email id  and password. We can create as many servers as we like. But two different servers with same email id is not allowable.

   The picture below shows a list of SMTP Sever instances. Each server is used for different purposes. For example, one is used for sending emails related to marketing and that may be configured using the email id of the marketing section and one for sending task related emails and that one uses the email id of the project management section.

 

Now we create a new entry from the menu where we are now (“Administration/Configuration/Sendmail Services/SMTP Servers” )

Configuration Tab

 

Here i am mentioning  the necessary fields only, leaving some fields that are not much important

Server Name : You Can Use any name. This filed is just for the purpose of identifying your server
Server Type : The selection field allows you to choose the server related to the email id you are going to provide . It automatically fills some basic details of the server if you are selecting yahoo or google. Other wise you have to  provide them manually
Email Address : Specify the email address
SMTP Server : If the server type you selected is “Other Mail Servers”, provide the corresponding value(may be something like ‘smtp.yourdomain.com’)
Email From : The Name to be displayed in the “From” field
SMTP Port :  port number of your smtp server(25 is the default value)
Use Auth : Check the field
Use SSL : You have to check or un-check the field based on your SMTP Server. If Google is the server it must be checked.
User Name and Password : provide the complete user name including the domain like, contact@zbeanztech.com . Provide the password

Permission Tab

  Select and include all the users who are indented to use this particular server. Save the form

Server Verification

       After Saving all the details, use the wizard, ‘Send Verification Code’. It prompts for an email id. Provide any email id. The verification code will be sent to that email address. Now use the wizard “Verify Server”. Provide the verification code you received in email. Once you provide the correct code the “Server Status”  changes to “Verified”. After verification “Start” the server, using the button . Now your server is ready to send emails. You can test it by using the wizard “Send Test Email”

Message Queue

       Every mail triggered from the server is first passed into the Message Queue and there after processed with the help of a scheduler. The message queue helps the user to identify whether the email was sent or not. The field “Message Status” indicates the status of the message in the queue

“Send Email” Scheduler
    Scheduler is another use full feature of OpenERP, which i have mentioned in another blog named Schedulers in OpenERP .  You can see the particular scheduler here  “Administration/Configuration/Scheduler/Scheduled Actions”.

        As per default configuration, the “Send Email” Scheduler, checks and processes the message queue every one minute. Ultimately this scheduler is the one that is responsible for sending emails. So make sure that it is active and  configured properly. 

     Developers can evoke the “send_email” funcion of the object ’email.smtpclient’, in situations where an email is to be send. The function takes smtp server id, list of recepient email ids , subject , body  etc.. as its arguments. Even reports and attchments also can be passed as arguments so that the email will carry them.

Comments

Juliann: Thanks for ones marvelous posting! I certainly enjoyed reading it, you will be a great author.I will make sure to bookmark your blog and will come back later on. I want to encourage you to ultimately continue your great writing, have a nice weekend!".

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Atul Modi says:

    Thanks buddy for you comprehensive explanation regarding this.
    I have done this rather it was set by my people and now all of sudden i have change the password at that place.
    How can I get to change the password for that email ID into the system.
    Because when we log to OpenERP 6.0 or higher than we go to
    Admin>Administrator>Configuration>SendMail Service>noreply@aristatechnologies.com ID was opened.
    Now when I tried to change the password it is greyed out.
    How can I change the password as an when I change the password for this account or any other accounts which at associated with OpenERP from inside.
    note: I am able to do all change into EMAIL Account through my browser at my domain, but not inside the openERP.
    Can you send me reply at info@aristatechnologies.com
    thank you,

    1. tamleminh says:

      Thank vishnu for your thread.
      I am having problems with the smtpclient on OpenERP V6. We are using it with gmail and when I try to verification mail. but open ERP doesn’t have wizard ‘send verification code’ so I can’t verify.Can you help me

    2. Juliann says:

      Thanks for ones marvelous posting! I certainly enjoyed reading it, you will be a great author.I will make sure to bookmark your
      blog and will come back later on. I want to encourage you to ultimately continue your great writing, have
      a nice weekend!

  2. Hi vishnu,
    This is a great job. Thank you very much for doing this.
    I am having problems with the smtpclient on OpenERP V6. We are using it with Google Apps and when we try to send test mail or verification mail, system just freezes. Then we restart the openerp-web service, that is how we can reach to openerp again.
    What do you think the problem is ? If it is long to describe can you get in touch with me personally ?
    Thanks

  3. muthunaveen says:

    did the above things were same for 6.1 also ?
    can support me for 6.1 configuration?
    With thanks
    naveen

© 2020 Zesty Beanz Pvt Ltd All Rights Reserved.