public override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; TextRelay txt_subject = (TextRelay)info.GetTextEntry(2); string subject = txt_subject.Text; TextRelay txt_message = (TextRelay)info.GetTextEntry(3); string message = txt_message.Text; if (info.ButtonID == 1) { Account acct = (Account)Targ.Account; string key = acct.Username; string to = (string)EmailHolder.Emails[key]; message += "\n\n This email was sent by " + from.Name + " at the time of " + DateTime.Now.ToString() + " using the email system on the " + RegisterEmailClient.ServerName + " shard."; EmailEventArgs eea = new EmailEventArgs(true, null, to, subject, message); RegisterEmailClient.SendMail(eea); from.SendMessage("The email is being sent."); } else { from.SendMessage("You decide not to send the email."); } }
public override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; switch (info.ButtonID) { case 0: { from.SendMessage("Please be sure to register your email address at some point in time."); break; } case 1: { TextRelay txt = (TextRelay)info.GetTextEntry(2); string s = (string)txt.Text.Trim(); Account acct = (Account)from.Account; string key = (string)acct.Username; if (CanValidate(s, key, from)) { string email = (string)EmailHolder.Confirm[key]; if (!EmailHolder.Emails.ContainsKey(key)) { EmailHolder.Emails.Add(key, email); } else { EmailHolder.Emails.Remove(key); EmailHolder.Emails.Add(key, email); } if (EmailHolder.Confirm.ContainsKey(key)) { EmailHolder.Confirm.Remove(key); EmailHolder.Codes.Remove(key); } string msg = "Congragulation on sucessfully registering your email address, You will now be able to recieve special announcment s via email and use the in game commands \"[account\" to manage your password and email address and \"[email\" to send emails to other players. \n \n" + "Thank You"; EmailEventArgs eea = new EmailEventArgs(true, null, email, "Email Registered", msg); RegisterEmailClient.SendMail(eea); from.SendMessage("Thank you for registering your email."); } else { from.SendMessage("The code you entered is either not correct, or no longer valid."); } break; } } }
public override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; switch (info.ButtonID) { case 0: { from.SendMessage("You decide not the send the email."); break; } case 1: { TextRelay txt1 = (TextRelay)info.GetTextEntry(2); string subject = txt1.Text.Trim(); TextRelay txt2 = (TextRelay)info.GetTextEntry(3); string msg1 = txt2.Text.Trim(); TextRelay txt3 = (TextRelay)info.GetTextEntry(4); string msg2 = txt3.Text.Trim(); List <MailAddress> emails = new List <MailAddress>(); IEnumerator key = EmailHolder.Emails.Keys.GetEnumerator(); for (int i = 0; i < EmailHolder.Emails.Count; ++i) { key.MoveNext(); string k = (string)key.Current; MailAddress ma = new MailAddress(EmailHolder.Emails[k]); if (!emails.Contains(ma)) { emails.Add(ma); } } EmailEventArgs eea = new EmailEventArgs(false, emails, "", subject, (msg1 + msg2)); RegisterEmailClient.SendMail(eea); break; } } }
public override void OnResponse(NetState sender, RelayInfo info) { PlayerMobile from = (PlayerMobile)sender.Mobile; Account acct = (Account)from.Account; string key = (string)acct.Username; switch (info.ButtonID) { case 0: { from.SendMessage("You decide not to change your password."); break; } case 1: { TextRelay txt = (TextRelay)info.GetTextEntry(2); string s = (string)txt.Text.Trim(); TextRelay txt2 = (TextRelay)info.GetTextEntry(3); string s2 = (string)txt2.Text.Trim(); TextRelay txt3 = (TextRelay)info.GetTextEntry(4); string s3 = (string)txt3.Text.Trim(); if (ValidatePassword(from, s, s2, s3)) { acct.SetPassword(s2); from.SendMessage("Your password has changed, your new account details are being sent to you by email."); string msg = "You have changed your password to \n\n" + s2 + "\n\n On account\n\n" + acct.Username + "\n\n This email has been sent as a protection method against account hacking, this message was sent at " + DateTime.Now.ToString() + " server time.\n Thank You"; string email = (string)EmailHolder.Emails[acct.Username]; EmailEventArgs eea = new EmailEventArgs(true, null, email, "Password Changed", msg); RegisterEmailClient.SendMail(eea); } else { from.SendMessage("Either the password you entered did not match your old password, or you new password was entered incorrectly a second time, please try again."); } break; } } }
public override void OnResponse(NetState sender, RelayInfo info) { if (EmailHolder.Emails == null) { EmailHolder.Emails = new Dictionary <string, string>(); } if (EmailHolder.Confirm == null) { EmailHolder.Confirm = new Dictionary <string, string>(); } if (EmailHolder.Codes == null) { EmailHolder.Codes = new Dictionary <string, string>(); } Mobile from = sender.Mobile; switch (info.ButtonID) { case 0: { from.SendMessage("You will recieve this gump again next login."); break; } case 1: { TextRelay relay = (TextRelay)info.GetTextEntry(2); string txt1 = (string)relay.Text.Trim(); TextRelay relay2 = (TextRelay)info.GetTextEntry(3); string txt2 = (string)relay2.Text.Trim(); if (ValidateEmail(txt1, txt2)) { string c = CreateConFirmation(); Account acct = (Account)from.Account; string test = (string)acct.Username; string email = txt1; if (!EmailHolder.Confirm.ContainsKey(test)) { EmailHolder.Confirm.Add(test, txt1); EmailHolder.Codes.Add(test, c); } else { EmailHolder.Confirm.Remove(test); EmailHolder.Codes.Remove(test); EmailHolder.Confirm.Add(test, txt1); EmailHolder.Codes.Add(test, c); } string msg = "Thank you for submiting your email, you must use the 10 character long confirmation code below to confirm you got this email \n \n" + c + "\n \n To use this confirmation code you must type \"[auth\" in game and enter the code exactly as it appears here in the email into the text box provided. \n \n" + "Thank You";; EmailEventArgs eea = new EmailEventArgs(true, null, email, "Email Registration", msg); RegisterEmailClient.SendMail(eea); from.SendMessage("You have been sent a confirmation code, it will expire when you next log out."); } else { from.SendMessage("You have not entered your email correctly, please try again."); from.SendGump(new RegisterEmailGump()); } break; } } }