Я использую библиотеку SwiftMailgun для отправки электронной почты в приложении, над которым я работаю, и в bodyHTML я хочу добавить к нему переменную. Я хочу заменить 00432 на resetToken, который я получаю из базы данных, но у меня возникают проблемы при этом
//getting the resetToken from response
let resetToken = jsonData.value(forKey: "token") as! String?
print(resetToken!)
let mailgun = MailgunAPI(apiKey: "c0c5741e8ef55e9b2307e137ae5b3e92-c1fe131e-add76801", clientDomain: "sandbox732ceb9922894a27beeabb106146127b.mailgun.org")
mailgun.sendEmail(to: self.emailAddress.text!, from: "HellooFood Account Password Reset <HellooFood@HellooFood.com>", subject: "HellooFood Account Password Reset", bodyHTML: "Hi there <br> We heard that you lost your password, but dont worry! You can use the code below to reset your password within the next day.<br> <b>00432</b><br>Enter the code in the reset password field to reset your password. <br><br>If this mail is a mistake. just ignore it and nothing will happen.<br>If you are not the one who requested the Password Reset Contact us as soon as possible. <br><br>Thanks HellooFood") { mailgunResult in
if mailgunResult.success{
//switching the screen
let goToResetVC = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "Reset")
self.navigationController?.pushViewController(goToResetVC, animated: false)
SVProgressHUD.dismiss(withDelay: 1.6)
}else{
SVProgressHUD.dismiss()
let alert = UIAlertController(title: "No internet connection", message: "Check your data or wifi and try again", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Ok", style: .destructive, handler: nil))
//alert.addAction(UIAlertAction(title: "No", style: .cancel, handler: nil))
self.present(alert, animated: true)
}
}
Спасибо за вашу помощь