5

How would you send an automatic email in a swift ios app? I don't want to use MessageUI because it is not automatic. How could you do this?

jh314
  • 27,144
  • 16
  • 62
  • 82
Noah Barsky
  • 507
  • 1
  • 5
  • 5
  • 2
    This looks like a repetition of your previous question http://stackoverflow.com/questions/28963514/sending-email-with-swift. – Martin R Mar 13 '15 at 14:01
  • What's the use case? In your other question you mention password reset, but that would be something handled by the application server that your iOS app was logging into, not the app on the phone itself. – Rup Mar 13 '15 at 14:57

3 Answers3

4

If you're looking to programmatically send emails, I would use MailCore to do this, which can use the SMTP/IMAP protocols. It works on both OSX and iOS too! Here is a great SMTP example in Swift: Sending Mailcore2 Plain Emails in Swift

Community
  • 1
  • 1
allthethings
  • 773
  • 1
  • 7
  • 9
1

The thing is that Apple does not allow you to send e-mails in the background. I came across that problem as well. You'll have to let the user confirm to send it. So create the mail and let it pop up, then the user just needs to press send.

Thats unfortunately the only way to do it.

Hope it helps :)

LinusGeffarth
  • 27,197
  • 29
  • 120
  • 174
0

Apple do not allow you to send emails in the background without user's interaction. The only way you can do this with using this blog. http://iosameer.blogspot.in/2013/01/sending-e-mail-in-background-from-ios_25.html. It will surely work for you.

Ayush Dixit
  • 467
  • 4
  • 10
  • It would be better if you can put here the relevant part and not only use a link. Links can disappear over time and makes your answers useless. – King Midas Mar 14 '18 at 10:08
  • 1
    This article gives code in Objective-C. The requirement in the original question says "Swift". – Will Buffington Sep 19 '18 at 03:23