Skip to content

Instantly share code, notes, and snippets.

@komatzz
Created May 22, 2018 09:30
Show Gist options
  • Select an option

  • Save komatzz/53211222153c3a045f440a2d77acf10e to your computer and use it in GitHub Desktop.

Select an option

Save komatzz/53211222153c3a045f440a2d77acf10e to your computer and use it in GitHub Desktop.
Laravel + SendGrid Web API でメール送信する ref: https://qiita.com/komatzz/items/7873ad6a86aedac46863
"require": {
"sendgrid/sendgrid": "~6.2"
},
curl --request POST \
--url https://api.sendgrid.com/v3/mail/send \
--header 'Authorization: Bearer ここにAPI Keyを入れる' \
--header 'Content-Type: application/json' \
--data '{"personalizations": [{"to": [{"email": "test-to@gmail.com"}]}],"from": {"email": "test-from@gmail.com"},"subject": "Hello, World!","content": [{"type": "text/plain", "value": "Heya!"}]}'
...
$sendData = [
'id' => $request->get('id'),
];
$content = new Content(
'text/plain',
strval(
view(
'emails/templates/test_mail',
$sendData
)
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment