Я пытаюсь отправить свое первое электронное письмо с помощью Sendgrid:
<?php
$url = 'https://api.sendgrid.com/';
$user = 'bio'; //bio
$pass = 'xx.xxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxx_xxxxxxxxxxxxxxxxxx');';
// grabs HTML form's post data; if you customize the form.html parameters then you will need to reference their new new names here
$name = "a";
$email = "[email protected]";
$subject = "fdfdfd gdfg";
$message = "dfgd fhg fghfd ";
// note the above parameters now referenced in the 'subject', 'html', and 'text' sections
// make the to email be your own address or where ever you would like the contact form info sent
$params = array(
'api_user' => $user,
'api_key' => $pass,
'to' => "[email protected]", // set TO address to have the contact form's email content sent to
'subject' => "Contact Form Submission", // Either give a subject for each submission, or set to $subject
'html' => "<html><head><title> Contact Form</title><body>",
'from' => "[email protected]", // set from address here, it can really be anything
);
//curl_setopt($url, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
$request = $url.'api/mail.send.json';
// Generate curl request
$session = curl_init($request);
// Tell curl to use HTTP POST
curl_setopt ($session, CURLOPT_POST, true);
// Tell curl that this is the body of the POST
curl_setopt ($session, CURLOPT_POSTFIELDS, $params);
// Tell curl not to return headers, but do return the response
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
// obtain response
$response = curl_exec($session);
curl_close($session);
// print everything out
print_r($response);
?>
Вот ошибка, с которой я сталкиваюсь:
{"errors":["Bad username / password"],"message":"error"}
Где я должен получить информацию для авторизации, чтобы я не получил ошибку неверного имени пользователя / пароля?
Задача ещё не решена.
Других решений пока нет …