dazedmouse
Sorceror
I put this in but no gump comes up... cant call one up either
Having the same issue.I put this in but no gump comes up... cant call one up either
public class RegisterEmailClient
{
public static bool Enabled = false; // Is this system enabled?
Is there a method to changing the string that is sent to users via email? I'd like to customize mine a bit, and advise them of how to change their email in the future (if they must), since I have merged this system with my MOTD; as well as giving them a heads up on just what the emails are used for.
I know I'm able to edit the string in EmailRegisterGump, but there's some weird syntax in the line that I'm not familiar with. (i.e. the + 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"; ;
Here is the solution to the Gmail problem. You can use gmail or google apps (free google email for you domain name) using this method. First, the problem is that to send through gmail, you must use SSL, which requires a trusted certificate. If you don't have it, connection will be refused.
Simple to fix, open term, and...
Code:certmgr -ssl -m smtps://smtp.gmail.com:465 mozroots --import --ask-remove --machine
answer [y] to questions.
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 be asked again to register 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;
}
}
}
}
}
using System;
using System.Text.RegularExpressions; /* Will's Edit*/
using Server;
using Server.Commands;
using Server.Items;
using Server.Mobiles;
using System.Collections;
using System.Collections.Generic;
using Server.Accounting;
using Server.Network;
using Server.Misc;
using Server.Multis;
using Server.Targeting;
using Server.Gumps;
using System.Net.Mail;
using System.Threading;
using System.Net;
namespace Server.Gumps
{
public class RegisterEmailGump : Gump
{
/* Begin Will's Edit*/
private const string _emailRegex = @"^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$";
/* End Will's Edit*/
public RegisterEmailGump() : base(0, 0)
{
Closable = true;
Dragable = true;
Resizable = false;
AddBackground(47, 359, 409, 153, 3600);
AddLabel(204, 376, 1160, "Email Registration");
AddLabel(134, 404, 1153, "Email:");
AddAlphaRegion(180, 402, 255, 20);
AddTextEntry(180, 402, 255, 20, 33, 2, "" );
AddLabel(80, 442, 1153, "Confirm Email:");
AddAlphaRegion(180, 439, 255, 20);
AddTextEntry(180, 439, 255, 20, 33, 3, "" );
AddButton(135, 474, 4007, 4006, 1, GumpButtonType.Reply, 0);
AddLabel(172, 476, 1153, "Submit");
}
public bool ValidateEmail(string s, string s2)
{
/* Begin Will's Edit*/
if (!Regex.IsMatch(s, _emailRegex))
{
return false;
}
/* End Will's Edit*/
if (s == "" || s2 == "")
return false;
if (!s.Contains("@") || !s2.Contains("@"))
return false;
if (s != s2)
return false;
return true;
}
you mean change password gump?
ah we must used dif versions of this, I use the most recent I do not have a ChangeEmail gump
I applied the fixes you posted with the new system and so far I have not found a way to crash my shard So I would say its good to go but any changes you make I would love to see.