2012-08-17 29 views
5

tôi đang cố gắng để gửi email bằng email tinh tinh api nhưng lỗi sau occoursgửi thư điện tử sử dụng email tinh tinh api

{"aws_type":null,"aws_code":null,"http_code":500,"message":"Invalid Mailchimp API Key: <snip>-us5 . You are accessing the wrong datacenter - your client library may not properly support our datacenter mapping scheme."} 

i kiểm tra chính api MailChimp của tôi và nó correct.If bất kỳ một trong biết vui lòng trả lời dưới đây là mã của tôi

$apikey = 'api_key'; 

$to_emails = array('[email protected]'); 
$to_names = array('You', 'Your Mom'); 

$message = array(
    'html'=>'Yo, this is the <b>html</b> portion', 
    'text'=>'Yo, this is the *text* portion', 
    'subject'=>'This is the subject', 
    'from_name'=>'Me!', 
    'from_email'=>'[email protected]', 
    '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://us1.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); 

$data = json_decode($result); 
echo "Status = ".$data->status."\n"; 
+0

chỉ là một câu hỏi: "tại sao gửi bằng cách sử dụng mailchimp khi bạn có thể gửi nó bằng cách sử dụng php chính mình?" –

Trả lời

2

Nếu không làm nghiên cứu nhiều hơn, tôi muốn thử thay đổi $url-http://us5.sts.mailchimp.com/1.0/SendEmail từ API đầu chìa khóa của bạn trong -us5 và nó phàn nàn rằng bạn đang đánh trung tâm dữ liệu sai.

+0

cảm ơn sblom, tôi đã thay đổi nó nhưng sau đó lỗi này xảy ra {"aws_type": null, "aws_code": null, "http_code": 500, "message": "Hãy thiết lập tích hợp trước"} là có bất kỳ tích hợp nào khác bộ – rohit

Các vấn đề liên quan