internal List <string> GetEmailAddressesAndSubjects() { List <string> addresses = new List <string>(); string addressPath = PathGenerator.GetAddressesPath(); string addressContent = FileReader.ReadTextFile(addressPath); foreach (var address in addressContent.Split(',')) { addresses.Add(address); //addresses.Add(address.Split(':')[0]); } return(addresses); }
private async void sendResume_ClickAsync(object sender, EventArgs e) { try { //Get Addresses: subject Helpers helpers = new Helpers(); Emailer emailer = new Emailer(); Applicant applicant = new Applicant(); List <string> applications = new List <string>(); List <string> addressesAndSubjects = helpers.GetEmailAddressesAndSubjects(); //Get body of mail from file string emailBody = helpers.GetEmailBody(); //Get Resume string resumePath = PathGenerator.GetResumePath(); var resume = helpers.GetResume(resumePath); var tempResumeName = Path.GetFileNameWithoutExtension(resume); foreach (var emailHeader in addressesAndSubjects) { //emailer.SendEmailHtmlMessageAttachment(applicant.ApplicantEmail, emailHeader.Split(':')[0], emailHeader.Split(':')[1], emailBody, resume, tempResumeName, resumePath); if (emailer.SendEmailGmail(emailHeader.Split(':')[0], emailHeader.Split(':')[1], emailBody, tempResumeName, resume)) { applications.Add(emailHeader); } } if (applications.Count > 0) { await helpers.SaveApplicationsDoneAsync(applications, PathGenerator.GetApplicationFilePath()); } //Get Addresses: subject //Get body of mail from file //Get CV } catch (Exception ex) { throw; } }
internal string GetEmailBody() { string emailBody = FileReader.ReadTextFile(PathGenerator.GetEmailBodyPath()); return(emailBody); }