I see there are many ways to send email in the background (without UI) in iOS devices and without using MFMailComposeViewController class. Most popular examples are fill an online form and press submit button. Here are the most popular methods i see in stackoverflow..
(1) Using your own SMTP client. This approach is working for me but in my private network but not working in my company premises as in company network I am not allowed to use gmail (public emails) and don't have SMTP details of our company mail server. I am struck here in this approach.
(2) Using CTCoreMessage & Three20 Framework (open source). But here I am not able to find where to download this framework other than git, where my pc VLAN not allowing GIT. Could somebody help me to find out the Three20 Framework downloadable location and share me an example code.
(3) Using HTTP Post: Send your email body to the server and delegate the email sending to the HTTP Server. If this is simple then can somebody help me how to setup your own HTTP Server for sending emails.
Could anybody help in finding any working sample code. I am at end of my project delivery. Posted this long back. No replies till now. Could anybody help me please..
I might be able to provide some help for the third option, using HTTP Post, since I did implement it once in a project.
First, I used this nice and simple iOS class to take care of the posting for me. Then, the following iOS code snippet should show you how it's done
For the PHP file, this should do the trick
Keep in mind, I'm no PHP expert, so that code might be improved, especially on the security part.
[edit] PHP mailing should already be enabled in most major managed hosting solutions, be it a cheap shared account, a VPS or a dedicated server. But if you plan to send A LOT of emails with this method, then a dedicated server is recommended.
However, there is a limit of emails you can send and better options than the
mail
function. You can find more info about this here.[later edit] It seems the author deleted the SimplePost class. However, the same author made an alternative which should help, called SimpleHTTPRequest. The rest should remain the same
I would look into using Mailgun, it will make sending emails much easier and handles up to 10k a month for free. They allow you to use their subdomain if you dont have your own, but can easily setup your own to work with theirs.
Its as easy as installing up a cocoapod and adding 5 lines of code or so.