2016-06-23 5 views
0

UITextFieldからメールにテキストを送信しようとしていますが、何も送信しませんが、textViewを使用していれば正常です。ここでは、コードの一部です:ここでSwITMailGunを使用してUITextFieldからテキストを送信します

@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

「何も送信しない」とはどういう意味ですか?空メールが届くのですか、何も受け取りませんか? Btw。あなたの質問にあなたの実際のデータを投稿すべきではありません:) – JohnnyAW

+0

それは電子メールを送信しませんでした。 「実際のデータ」はどういう意味ですか? –

+0

hmm、クラッシュしたのか例外をスローしましたか?あなたのAPIキー、クライアントドメイン、電子メールは実際のデータのように見えますが、ランダムな文字列だけではありません。 – JohnnyAW

答えて

0

おっと!それは私の失敗でした!

@IBAction func sendButton(sender: UIButton) { 

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


    mailgun.sendEmail(to: "[email protected]", from: "Test User <[email protected]>", subject: message.text!, bodyHTML: tema.text!) { mailgunResult in 

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

    } 

} 
関連する問題