我正在使用laravel开发Web应用程序。在此应用程序中,我必须向用户发送电子邮件。现在,我想使用mailchimp发送那些电子邮件。谁能指导我如何使用laravel中的mailchimp发送一对一的电子邮件。我正在使用以下代码发送电子邮件,请检查并告知我该怎么做
$apikey = '<key>-us12';
$to_emails = array('test@gmail.com');
$to_names = array('test');
$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' => 'OMO CRM',
'from_email' => 'customerservice@test.com',
'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 = "https://us12.api.mailchimp.com/3.0/";
$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";
我无法使用上述代码发送电子邮件。