There are literally hundreds of ESPs (Email Service Providers).
Many of them offers APIs that can be programmed. You just need to define clearly what exact automation functionality you need and then select the right ESP based on API features and other factors, that surely would include pricing.
YC recently funded an ESP as well: http://www.mailgun.com
Take a look