public void DisplayEmail(int index = -1) { if (index == -1) { //print all for (int i = 0; i < receivedEmails.Count; i++) { DisplayEmail(i); } return; } if (index < 0 || index > receivedEmails.Count - 1) { Logger.Critical?.WriteLine("Error: Cannot display that email, index out of bounds."); return; } ReceivedEmail email = receivedEmails[index]; Console.WriteLine("-------- EMAIL BEGINS --------"); Console.WriteLine("Received at: " + email.receivedTime.ToString()); Console.WriteLine("From: " + email.sender); Console.WriteLine("To: " + email.recipient); Console.WriteLine("Additional info: "); for (int i = 0; i < email.senderInfo.Count; i++) { Console.WriteLine(" - " + email.sender[i]); } Console.WriteLine(); for (int i = 0; i < email.messageBody.Count; i++) { Console.WriteLine(email.messageBody[i]); } Console.WriteLine("-------- EMAIL ENDS --------"); }
public void NewMailReceived(string username, ReceivedEmail mail) { }
internal void NotifyReceivedMail(ReceivedEmail mail) { Logger.Info?.WriteLine("Server received mail from: " + mail.sender); receivedEmails.Add(mail); serverHooks.NewMailReceived(mail.recipient, mail); }