Odoo Help


Send Email with an attachment file

on 5/25/15, 7:59 AM 1,426 views


I am having a list files in my system files which are getting generated by a cron job. I want a mail to trigger everyday which has to make the generated file as attachment. I am able to send the mails but not able to attach the files. If I am using ir.attachment, I am able to attcach a static file. But I want to attach the file according to date. Please help me with a solution.

Thanks in advance



what does it mean static file?

on 5/25/15, 9:00 AM

For example, if we are using ir.attachment and give a path, The same file will be sent in all the mails. I stated that as static file. I need to change the attachment file everyday.

on 5/26/15, 2:15 AM

Techno-Functional Associate with 7+ years of experience in Odoo (formerly known as OpenERP).

On 5/26/15, 8:12 AM

I guess

It works best if you insert a file into Ir.Attachment object, then the same file can be used to attach in mail...

Note: you can write a logic in such a way that it reads the file from path, inserts into Attachment Object, then attach the same to mail

Thanks for the reply deep. If I do it that way, it will take the same file as attachment for all the mails. But my file changes everyday. For example, I am pulling a report daily which shows the list of sale orders done yesterday. I have to send the mail with that report according to the day. In this case, My file name changes everyday.

on 5/27/15, 2:30 AM

Just before sending the mail, you need to attach from the source, if you do so, you will not be sending the same attachment... first attach and then send.. If you do that you will always be sending the new attachment...

on 5/27/15, 2:43 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 5/25/15, 7:59 AM
Seen: 1426 times
Last updated: 5/26/15, 8:12 AM