ios - 无法使用 SwiftMailGun 从 UITextField 发送文本

标签 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

最佳答案

哎呀!那是我的失败!

 @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!)
        }

    }

}

关于ios - 无法使用 SwiftMailGun 从 UITextField 发送文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37991408/

相关文章:

c# - Xamarin.Forms:用于在 UITableViewCell 上显示披露指示器的自定义渲染器

ios - 如何使用 Facebook iOS SDK 管理生产和开发凭证

ios - swift 4错误的json数组解析

ruby-on-rails - rails : How "email_field" differs from "text_field"?

TextField 和属性之间的 JavaFX 绑定(bind)

ios - 在锁内嵌套 InvokeOnMainThread,反之亦然

string - 从常量 Ints 创建 Range<String.Index>

ios - 当多重选择模式打开时如何停止重定向到另一个 View

swift - “ fatal error :在展开可选值时意外发现nil”是什么意思?

ios - iOS 应用程序中的多个文本字段