How to send emails in Swift using Mailgun

后端 未结 3 1296
野性不改
野性不改 2021-01-01 02:55

I have the need to send automatic emails in a Swift project I\'m working on. So far my best lead seems to be using Mailgun. (I\'m open to better options if anyone has liked

3条回答
  •  被撕碎了的回忆
    2021-01-01 03:27

    I think i am facing exactly the same problem with you. But I am a little confused on how many .h and .m files you have used and what each one contains. I am clueless on obj C so I try to follow you blindly.

    Correct me if I am wrong.

    • You have one .h bridging header file that contains:

    //
    //  Use this file to import your target's public headers that you would like to expose to Swift.
    //
    
    #import "AFNetworking.h"
    #import 
    

    • You have one .m file that contains:

    #import 
    #import 
    
    @interface mailTest: NSObject
    - (void) sendMail: (NSString*)email;
    
    @end
    

    • And in your Viewcontroller.swift you have (lets say in a button) this:

    import UIKit
    
    class ViewController: UIViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }
    
    @IBAction func myButton(sender: UIButton) {
        var test: mailTest = mailTest()
        test.sendMail("testemail@testemail.com")
    }
    }
    

    Is that correct?

提交回复
热议问题