我正在尝试使用Alamofire和Mailgun从ios Swift应用程序的后端发送电子邮件,如
中所示但我想在我的电子邮件中输出HTML ..Below是我的代码
let key = "dfasewr4353terf34t43fefdf34r"
let EmailBody = "<html><body><table border='1'><tr><td>Jill</td><td>Smith</td><td>50</td></tr><tr>td>Eve</td><td>Jackson</td><td>94</td></tr><tr><td>John</td><td>Doe</td><td>80</td></tr></table></body></html>"
let parameters = [
"from":from@fromme.com,
"to": to@tome.com,
"subject": "my Email Subject",
"text": EmailBody
]
Alamofirerequest(.POST, "https://api.mailgun.net/v3/<MAILGUN-DOMAIN>/messages", parameters:parameters)
.authenticate(user: "api", password: key)
.response { (request, response, data, error) in
println(request)
println(response)
println(error)
}
And on click of the button, i get the email and the email body is still in HTML.I dont get Html tables but normal HTML text output as below
Output:
<html><body><table border='1'><tr><td>Jill</td><td>Smith</td><td>50</td></tr><tr>td>Eve</td><td>Jackson</td><td>94</td></tr><tr><td>John</td><td>Doe</td><td>80</td></tr></table></body></html>
必需的输出
答案 0 :(得分:1)
在参数中将文本更改为html,它就像魅力一样
让参数= [
“从”:from@fromme.com,
“to”:to @tome.com,
“subject”:“我的电子邮件主题”,
“html”:EmailBody
]