I am sending an email individually with MAILCHIMP
without using templates
, but the return
comes out empty, what would be the correct way to send the request message?
-The answer returns
empty and the mail does not arrive
-This is my post method
route: http://localhost:6002/api/mailchimp/message/send
"message": [
{
"subject": "student",
"from_email": "ingenieria@uni.edu.pe",
"html":"<p>Estudia en la UNI</p>",
"text": "Estudia en la UNI",
"to": [
{
"email": "pedro.24@gmail.com",
"type": "to"
}
]
}
]
}
function
public function send(Request $request)
{
$message = $request->message;
$mailchimp = new MailchimpTransactionalApiClient();
$mailchimp->setApiKey(env('MAILCHIMP_KEY'));
$response = $mailchimp->messages->send(
[
"message"=>$message
]
);
return response()->json($response, 200);
}
PD: in another method I receive the post using templates there if it works => $respuesta = $mailchimp->messages->sendTemplate(...)