What you want to look for is called an
SMTP Client[
^]. I have written several for use internally for my company (source not available) but these are fairly common.
One of the issues you will encounter is that mail relays are somewhat locked down these days, and you will likely need to do additional authorization and security steps from what are the likely default settings. If possible, you also want to use SSL and/or TLS options and don't send password info in clear text.