How to send email through MailChimp 3.0 api?

后端 未结 3 1919
情深已故
情深已故 2021-02-08 03:36

I\'m trying to send email through mailchimp api version 3.0 in php, but i have no luck. This is my code:

$postString = \'{
        \"message\": {
            \"h         


        
3条回答
  •  孤街浪徒
    2021-02-08 04:05

    'Yo, this is the html portion',
        'text'=>'Yo, this is the *text* portion',
        'subject'=>'This is the subject',
        'from_name'=>'Me!',
        'from_email'=>'',
        'to_email'=>$to_emails,
        'to_name'=>$to_names
    );
    
    $tags = array('WelcomeEmail');
    
    $params = array(
        'apikey'=>$apikey,
        'message'=>$message,
        'track_opens'=>true,
        'track_clicks'=>false,
        'tags'=>$tags
    );
    
    $url = "http://us5.sts.mailchimp.com/1.0/SendEmail";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url.'?'.http_build_query($params));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    
    $result = curl_exec($ch);
    echo $result;
    curl_close ($ch);
     var_dump($result);
    $data = json_decode($result);
    
    echo "Status = ".$data->status."\n";
     ?>
    

提交回复
热议问题