I am trying to send my first email using Sendgrid:
$sendgrid = new SendGrid('username', 'xx.xxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxx_xxxxxxxxxxxxxxxxxx'); $email = new SendGrid\Email(); $email->addTo(" email1@gmail.com ") ->setFrom(" email@domain.com ") ->setSubject("Sending with SendGrid is Fun") ->setHtml("and easy to do anywhere, even with PHP");
Here is the error I encountered:
PHP Fatal error: throw an exception "SendGrid \ Exception" with the message '{"errors": ["Bad username / password"], "message": "error"}'
Instead of "username" and "xx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" I, of course, use the real API key information from the Sendgrid settings: 
I used the long string key provided after creating the API key. But there is still something wrong with this line: $ sendgrid = new SendGrid ('username', 'xx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_xxxxxxxxxxxxxxxxxx');
Where can I get authorization information so that I don't get a Bad username / password error?
source share