public void addMail(string mail, string userTo) { for (int index = 0; index < this.responders.Count; ++index) { this.responders[index].mailReceived(mail, userTo); } Folder folder = (Folder)null; for (int index = 0; index < this.accounts.folders.Count; ++index) { if (this.accounts.folders[index].name.Equals(userTo)) { folder = this.accounts.folders[index].folders[0]; break; } } if (folder != null) { folder.files.Insert(0, new FileEntry(mail, MailServer.getSubject(mail))); } else { throw new NullReferenceException("User " + userTo + " has no valid mail account on this mail server :" + this.comp.idName + ". Check account type and name matching!"); } }
private void AddSentEmailRecordFileForMissionCompletion(ActiveMission mission, List <string> additionalDetails) { try { Folder folder = this.userFolder.searchForFolder("sent"); string body = mission.email.subject + " completed."; if (additionalDetails != null && additionalDetails.Count > 0) { body += "\nRequested Details:\n"; for (int index = 0; index < additionalDetails.Count; ++index) { body = body + additionalDetails[index] + "\n"; } } string email = MailServer.generateEmail(mission.email.subject + " : Complete", body, this.user.name + "@" + this.comp.name); string subject = MailServer.getSubject(email); FileEntry fileEntry = new FileEntry(email, subject); folder.files.Add(fileEntry); } catch (Exception ex) { } }