无法使用SwiftMailGun从UITextField发送文本

时间:2016-06-23 12:17:43

标签: ios swift textfield mailgun

我试图将一些文本发送到UITextField的电子邮件中,但它什么也没发送,但是当我使用textView时,所有工作正常。以下是代码的一部分:

@IBAction func sendButton(sender: UIButton) {

    let mailgun = MailgunAPI(apiKey: "key-*************",
                             clientDomain: "*********.mailgun.org")

    mailgun.sendEmail(to: "**********@gmail.com", from: self.tema.text!, subject: self.message.text!, bodyHTML: "<b>test<b>") { mailgunResult in

        if mailgunResult.success{
            print("Email was sent")
            print(self.tema.text!)
            print(self.message.text!)
        }

    }
}

这是控制台输出: enter image description here

1 个答案:

答案 0 :(得分:0)

糟糕!那是我的失败!

 @IBAction func sendButton(sender: UIButton) {

    let mailgun = MailgunAPI(apiKey: "key-***************",
                             clientDomain: "sandbox***************.mailgun.org")


    mailgun.sendEmail(to: "mdmabook@gmail.com", from: "Test User <test@test.com>", subject: message.text!, bodyHTML: tema.text!) { mailgunResult in

        if mailgunResult.success{
            print("Email was sent")
            print(self.tema.text!)
            print(self.message.text!)
        }

    }

}