Skip to Content
Menu
This question has been flagged

I have a contact form made in html:

<div class="gi-form">
    <form name="send_mail" method="post">
        <table border="0" cellspacing="0" cellpadding="2">
            <tbody>
                <p>Support contact</p>
                    <tr>
                        <td><textarea cols="50" rows="1" name="Subject">Subject</textarea></td>
                    </tr>
                    <tr>
                        <td><textarea cols="50" rows="5" name="Mitteilung">Your Message</textarea></td>
                    </tr>
                    <tr>
                    <td>
                        <button string="Send E-mail" type="object" name="send_mail">Send</button>
                    </td>
                    </tr>
            </tbody>
         </table>
    </form>


In PYthon I use this function:

from openerp.osv import osv, fields
from openerp import api
import smtplib

class mail_mail(osv.osv):
 _name = 'mail_mail'
 _inherit = ['mail.mail']

 @api.one
 def send_mail(self,cr,uid,ids,odoo_record,context=None):
 ir_mail_server = self.pool.get('ir.mail_server')
 title = "Your e-mail title"
message = "This is the concent from your e-mail. An example from a field inside the e-mail: " + odoo_record.odoo_dns_url + "\n\nWith kind regards,\nYenthe"
#Structure mail function: def build_email(self, email_from, email_to, subject, body, email_cc=None, email_bcc=None, reply_to=False, msg = ir_mail_server.build_email("test@gmx.ch", ["test@gmx.ch"], title, message,["test@gmx.ch"],[],"test@gmx.ch")
ir_mail_server.send_email(cr, uid, msg)

But when I click the button from the form, I never get in this function right here "send_mail"

How Can I make this form button above, to send an email to an email address with a subject and the content text??


Thank you




Avatar
Discard
Related Posts Replies Views Activity
2
Jan 23
242
1
Oct 20
3165
3
Jan 20
4418
1
Mar 15
8067
0
Mar 24
252