6

Iphone sdk : how to send an email in background from an iphone app.

Based on certain selections made by the user I want to trigger an event to send an email to an admin.

I am aware of the MFMailComposeViewController but this will open the mail composer window which I want to skip.

2 Answers2

1

You will need to use a third party library for that. The SDK doesn't allow you to send emails in the background.

Here's one you can use:

http://code.google.com/p/skpsmtpmessage/

oscarm
  • 2,630
  • 6
  • 41
  • 74
0

This is an old question, but for anyone coming across it still you can take a look at this post. The accepted answer shows how to send the email in a background using a smtp server. It also includes an image that will "dim" the screen as the email is sent and "brighten" back up after the email is sent. Take a look at the screen shot to see what I mean.

Locking the Fields in MFMailComposeViewController

Community
  • 1
  • 1
Louie
  • 5,920
  • 5
  • 31
  • 45
  • Louie, do you know if Apple would reject my app if it sends email in the background? I will notify the user when the email was sent, and it doesnt contain any personal information, only the users score in a test he will do in my app.. Thanks, Newton. – newton_guima Mar 09 '12 at 17:37
  • 2
    Sending email in the background without the MailComposer won't be a problem. Im using that code in about 15 of my Live apps. Apple might want to see the user click "Send Score" though, and not just have you send it and THEN notify them that it was sent. Hope that makes sense. – Louie Mar 09 '12 at 17:56