Mandrill ValidationError

后端 未结 7 2414
花落未央
花落未央 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:02

    You may also want to just use arrays, and let PHP handle the JSON encoding for you. This particular error is common if the JSON is invalid for some reason. So, for example, you could set your parameters like this:

    $params = array(
        "key" => "keyhere",
        "message" => array(
            "html" => $content,
            "text" => $content_text,
            "to" => array(
                array("name" => $to, "email" => $to)
            ),
            "from_email" => $from,
            "from_name" => $from,
            "subject" => $subject,
            "track_opens" => true,
            "track_clicks" => true
        ),
        "async" => false
    );
    
    $postString = json_encode($params);
    

    You can also use json_decode to parse the response if needed.

提交回复
热议问题