// Token: 0x06000245 RID: 581 RVA: 0x00009F60 File Offset: 0x00008160 public static bool IsValidSmtpAddress(string address, bool checkLength, out int domainStart, bool allowUTF8 = false) { if (string.IsNullOrEmpty(address)) { domainStart = -1; return(false); } if (checkLength && address.Length > 571 && (address.Length > 1860 || !MimeAddressParser.IsEncapsulatedX400Address(address))) { domainStart = -1; return(false); } int num = 0; MimeAddressParser.ValidationStage validationStage = MimeAddressParser.ValidationStage.BEGIN; while (num < address.Length && validationStage != MimeAddressParser.ValidationStage.ERROR) { char c = address[num]; num++; switch (validationStage) { case MimeAddressParser.ValidationStage.BEGIN: if ((c < '\u0080' && MimeScan.IsAtom((byte)c)) || (c >= '\u0080' && allowUTF8)) { validationStage = MimeAddressParser.ValidationStage.LOCAL; continue; } if (c == '\\') { validationStage = MimeAddressParser.ValidationStage.LOCAL_ESC; continue; } if (c == '"') { validationStage = MimeAddressParser.ValidationStage.LOCAL_DQS; continue; } goto IL_1B6; case MimeAddressParser.ValidationStage.LOCAL: if (c == '@') { goto IL_182; } if (c == '.') { validationStage = MimeAddressParser.ValidationStage.LOCAL_DOT; continue; } break; case MimeAddressParser.ValidationStage.LOCAL_DOT: break; case MimeAddressParser.ValidationStage.LOCAL_DQS: if (c == '"') { validationStage = MimeAddressParser.ValidationStage.LOCAL_DQS_END; continue; } if (c == '\\') { validationStage = MimeAddressParser.ValidationStage.LOCAL_DQS_ESC; continue; } if ((c < '\u0080' && '\r' != c && '\n' != c && '\\' != c && '"' != c) || (c >= '\u0080' && allowUTF8)) { validationStage = MimeAddressParser.ValidationStage.LOCAL_DQS; continue; } goto IL_1B6; case MimeAddressParser.ValidationStage.LOCAL_ESC: if (c < '\u0080' || (c >= '\u0080' && allowUTF8)) { validationStage = MimeAddressParser.ValidationStage.LOCAL; continue; } goto IL_1B6; case MimeAddressParser.ValidationStage.LOCAL_DQS_ESC: if (c < '\u0080' || (c >= '\u0080' && allowUTF8)) { validationStage = MimeAddressParser.ValidationStage.LOCAL_DQS; continue; } goto IL_1B6; case MimeAddressParser.ValidationStage.LOCAL_DQS_END: if (c == '@') { goto IL_182; } goto IL_1B6; case MimeAddressParser.ValidationStage.DOMAIN: goto IL_182; default: goto IL_1B6; } if ((c < '\u0080' && MimeScan.IsAtom((byte)c)) || (c >= '\u0080' && allowUTF8)) { validationStage = MimeAddressParser.ValidationStage.LOCAL; continue; } if (c == '\\') { validationStage = MimeAddressParser.ValidationStage.LOCAL_ESC; continue; } IL_1B6: validationStage = MimeAddressParser.ValidationStage.ERROR; continue; IL_182: if (checkLength && num - 1 > 315 && (num - 1 > 1604 || !MimeAddressParser.IsEncapsulatedX400Address(address))) { domainStart = -1; return(false); } if (MimeAddressParser.IsValidDomain(address, num, checkLength, allowUTF8)) { domainStart = num; return(true); } goto IL_1B6; } domainStart = -1; return(false); }