How to send a txt file generated through email

How to email the txt file generated. I have already generated text file, but how to send the text file generated through email.
Reference to code to be written will be helpful!

Tryton provides the tools to retrieve EmailMessage from a report (preferably HTML or txt). Then this message can be passed to the sendmail tools.
You can find an example of such usage in the module notification_email.