Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd

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
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
2
jan. 23
242
1
okt. 20
4210
3
jan. 20
5434
1
mrt. 15
9371
0
mrt. 24
923