I'm working on some software that will, ideally, send an HTML email on behalf of the user from their personal email address. This wouldn't be a bulk mailing, it would go to one specific email address at a time. The most active users would be doing this a few times per day, with many users not using it on a daily basis at all. This is not an app with wide appeal, so I suspect the user base would be in the low thousands at most. And, lastly, each time the email is sent, it would be as a result of the user pressing a send button. I plan to have an iOS and PHP-based web version of the app.
Most of my users will be sending from one of the major email providers (Gmail, Yahoo, etc.), although a few will probably be using an address from their own domain.
I know that for iOS, there is an API to send a message using the built-in mail program, but this is not ideal for my situation since not everyone uses that program (I use the Gmail app, for example) and since there's also going to be a web app, it would be nice to be able to route everything through an API there so that I'm not duplicating too much code.
I understand that I can use PHP to send an email from any address, but it will likely be flagged as spam and the proper way to do it is with authenticated SMTP.
I also know that, for example, Gmail has an API for programmatically sending emails from an account as long as the account holder authorizes an app to do so.
I'm wondering if there's any library or service that exists that would essentially allow a user to pick from a list of major email providers and authorize my app using their APIs, or else enter in their own custom SMTP information if they're using their own server. I guess I can roll my own if need be, but I'm hoping not to reinvent the wheel. I'm also not sure how I'd be securely storing all of this email authentication information in my app database.
Any advice would be appreciated. Thanks!