I had a specific requirement to generate a CSV file and send the same as an attachment in a mail, without saving it at any physical location. I am listing here the way to do it. For further read Mail in Magento Add attachment to order email in Magento
While working in Joomla CMS, many times need arises to send mail from the components. Joomla has a class defined for doing this. I am listing here the method for sending mail.