This question has been flagged
5 Replies
4509 Views

I want to send an email to "test@foxmail.com" from "sending@foxmail.com" in some situation;

shall I get some advice for this?

Avatar
Discard
Author Best Answer

add picture for outgoing configure as below:

print "test.............................."
x=tools.email_send(email_from='116599778@qq.com',
email_to=['85876243@qq.com'],
subject='Some subject just a test',
body='Some body', )
print x
print "tested....................................."

add codes as above, when I do it and get the result as below:

test..............................

False

tested.....................................


I think there is still some problems.


Avatar
Discard
Best Answer

Hi, you may use 'message_post' of the 'mail.thread' model. E.g.:

    self.message_post(
                        body='some body',
                        subject='some subject',
                        partner_ids=partner_ids, # put here [Id], where id - is the partner with email test@foxmail.com
                        email_from = "sending@foxmail.com", #it would be shown as 'from' address. Real address would be taken from an outgoing email server.
                    )


Another way is to send the email directly via the Odoo tools:

from openerp import tools
tools.email_send(email_from='sending@foxmail.com',
                            email_to=[test@foxmail.com],
                            subject='Some subject',
                            body='Some body',)
Avatar
Discard
Author

thanks for your reply, I have tried as blow:

tools.email_send(email_from='sending@foxmail.com',

email_to=['test@qq.com'],

subject='Some subject',

body='Some body', )

but I get error as below:

Traceback (most recent call last):

File "D:\programs\odoo10\odoo\tools\mail.py", line 460, in email_send

attachments, message_id, references, openobject_id, subtype, headers=headers)

TypeError: unbound method build_email() must be called with ir.mail_server instance as first argument (got str instance instead)

It seems that your outgoing email server is not configured

Author

thanks for your reply again;

I have configured "outgoing email" as next reply on this post, but still failed;

more details are listed on the next post;

Maybe there is still some problems.