creates xml, write to file and send to email with the xml attached