There are a lot of scripts of the type you are talking about available on the web, and Google can point you to them (or you could just start by cruising hotscripts.com, which has a large selection).
Generally, given the load that large collections of WordPress plugins can place on a server, I would avoid trying to add that functionality in that way.
Whether using an existing script, or developing your own, I suggest the best “starting point” would be the DreamHost ToS and the anti-spam policy (take a look at abuse.dreamhost.com also), given the very specific requirements involved in complying with these policies.
Because of these requirements, I generally no longer recommend any such tools, and believe that the best way to handle email list management is with DreamHost’s own list tools (which are compliant with these policies, unless you abuse them.)
Of course, that is just my opinion and you may feel differently about that.
PHP has several mail related functions, and they are all described on php.net.