콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
12601 화면

Dear Sir/Madam,
How could I automatically send email when I submited a form.
Thank You

아바타
취소
베스트 답변

You need to have a python code that will generate the mail and send. You can place the below code (and modify it to fit your needs) in the model for which you want to send email, and than call the method send_mail("name of the temlate") from the code that handles your form submission, or I prefer to have a workflow associated with the model and send mail from the actions in the workflow.

    def send_mail(self, cr, uid, ids, context=None, template=""):
       for object in self.browse(cr, uid, ids, context=context):
            # Check if the parnter has "opt_out" for the mail
            if (not
object.partner_id.opt_out):
                template_id =
self.pool.get('email.template').search(cr, uid, [("name","=",template)])
                if template_id:
                    mail_message = self.pool.get('email.template').send_mail(cr,uid,template_id[0],object.id)

 

아바타
취소
작성자

PLEASE GIVE ME ONE COMPLETE EXAPMPLE

Can you explain? The code above is a compete example of sending email, all you need to do is to add the code to your model and call the self.send_mail from the place you need.

베스트 답변

hi aneesh,

you can sent the email automatically by using server actions.

You see the following link for using the automated email:

http://stackoverflow.com/questions/23908437/how-to-create-program-for-sending-mail-automatically-from-openerp-using-python

https://www.odoo.com/forum/help-1/question/create-a-module-for-automatic-send-email-when-customer-has-been-created-59924

아바타
취소