【问题标题】:mailgun stripping out inline formatting of htmlmailgun 剥离 html 的内联格式
【发布时间】:2017-11-01 13:48:42
【问题描述】:

我有相当多的格式化 HTML 要作为电子邮件发送出去,我正在使用 cURL 到 mailgun API 来测试它。只要没有内联格式(即从下面删除样式元素),Mailgun 就可以很好地发送 HTML 邮件,但是我介绍的第二个,它会去掉所有引号,并在第一个分号处停止。我是否需要转义其中一些字符,我该怎么做?

curl -s --user 'api:key-xx' \
    https://api.mailgun.net/v3/sandbox6ca85c222ca740ee9f3d36436e7e8516.mailgun.org/messages \
    -F from='Testy <postmaster@sandbox6ca85c222ca740ee9f3d36436e7e8516.mailgun.org>' \
    -F to='myaddress@example.com' \
    -F subject='Hello again' \
    --form-string html='<html><body>
<p style='font-family:"Calibri",sans-serif;font-size:10.0pt'>some text</p>
</body>
</html>'

【问题讨论】:

    标签: html mailgun


    【解决方案1】:

    您必须通过以下方式转义引号:

    --form-string html='<html><body><p style=\'font-family:\"Calibri\",sans-serif;font-size:10.0pt\'>some text</p></body></html>'
    

    【讨论】:

    • 谢谢,但这会导致这个错误:-bash: syntax error near unexpected token `newline'
    • 你需要把参数放在一行..让我更新代码
    • 另一个错误:-bash: 意外标记 `
    • 我刚查过,--form-string参数不需要在一行。只要我没有任何格式,它在几行上运行得非常好。
    猜你喜欢
    • 1970-01-01
    • 2013-03-15
    • 2013-02-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-04
    • 2018-05-20
    相关资源
    最近更新 更多