In some legislations it is obligatory, to send certain company information with every business email, such as the tax number etc. Because having this long stuff in the signature is ugly, I prefer to attach a vcard ("vcf") file with all emails. This can be easily ignored by most and easily used by some.
How can I attach a file to every outgoing email? It is OK, if the file is always the same for all users of the same company. (My setup is one-company, btw.)
One way that I can think of to accomplish what you are after is to create a module which defines a class that inherits from mail.mail.
You can override the send() function to first add your attachment to the mail message, and then call the superclass' send() function. That will give you exactly what you need, and probably configurability besides.
class autoattach_mail(osv.osv): _name='mail.mail' _inherit='mail.mail' def send(self, cr, uid, ids, auto_commit=False, recipient_ids=None, context=None): #TODO: add your attachment to each mail message in ids return super(autoattach_mail, self).send(cr, uid, ids, auto_commit=auto_commit, recipient_ids=recipient_ids, context=context)
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 6/19/13, 6:27 AM|
|Seen: 4041 times|
|Last updated: 9/19/15, 3:03 PM|