Skip to content

Instantly share code, notes, and snippets.

@martyncoup
Last active November 19, 2024 20:45
Show Gist options
  • Save martyncoup/0da47be96a80c81d02f0537faaffd709 to your computer and use it in GitHub Desktop.
Save martyncoup/0da47be96a80c81d02f0537faaffd709 to your computer and use it in GitHub Desktop.
Validate plus address against a root address
using System;
public static class Program
{
public static bool IsPlusAddressUsed(string plus, string root)
{
var parts = plus.Split('@');
var formattedEmail = $"{parts[0].Split('+')[0]}@{parts[1]}";
return formattedEmail == root;
}
public static void Main()
{
var email = "[email protected]";
var plusAddress = "[email protected]";
Console.WriteLine(IsPlusAddressUsed(plusAddress, email));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment