CAL-943 Agenda invitation sends an email with a 0 bytes .ics file

Fix description: in sendMail function, create ics file outside the loop of users and create attachment inside the mail of each participant.