Mandrill ValidationError

后端 未结 7 2415
花落未央
花落未央 2021-02-20 06:51

Very excited to be asking my first question on StackOverflow. I\'ve been relying on it to teach myself quite a lot over the years!

My question is this. I am getting the

7条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-20 07:13

    I don't know about mandrill, but your $content string has double quotes" in it and your delimiter in the $postString is also double quotes. This is going to break in any language. You need to escape the double quotes in the $content as required by mandril.

    "html": "' . $content . '", will translate to

    "html": "

    this is the emails html content

    ", ^ ^

    Try

     "html": "' . str_replace('"','\\"',$content) . '",
     "text": "' . str_replace('"','\\"',$content_text) . '",
    

    Instead of

     "html": "' . $content . '",
     "text": "' . $content_text . '",
    

提交回复
热议问题