private void LoginFormClosed(object sender, EventArgs e) { if (login.UserName != "") { gmail = new IMAPGmailHandler(login.UserName, login.Password); if (gmail.ConnectToGmail() != null) { PopulateMails(); } else { UserLogInPopUp(IMAPGmailHandler.errorMsg); } } }
private void btnReply_Click(object sender, EventArgs e) { string subject = "RE: " + mailSubject; string body = replyMail.Text; string adress = txtBoxToFrom.Text; if (body == "") { body = "This is an empty e-mail, I'm clicking stuff randomly. Sorry.."; } try { string username = gmail.UserName; string password = gmail.Password; IMAPGmailHandler.SendEmail(subject, body, adress, username, password); } catch (NullReferenceException ex) { Console.WriteLine("Clicking buttons are you? Message: " + ex.Message); } replyMail.Text = ""; }