writing such a thing including mail tracking is quite easy :) i worked for emarsys who is one of the bigger ones for professional mail sending :)
usually you maintain the list yourself and just sync it. but i havent looked into the buisness for 5 years :)
in the end, if you don't wanna track your emails services like sendgrid are an possibility or other relays or you can use mailchimp if you need a/b splitting and inbox previews .
it just depends on the languag and the need. if you want to maintain it yourself and want to have multiple subscription options I recommend looking into bitmaps to use easy scalable filters :) and use an server rewrite of an image src for the opening tracking :) so at least you have a starting point of the basics :)