Created
May 22, 2018 09:30
-
-
Save komatzz/53211222153c3a045f440a2d77acf10e to your computer and use it in GitHub Desktop.
Laravel + SendGrid Web API でメール送信する ref: https://qiita.com/komatzz/items/7873ad6a86aedac46863
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "require": { | |
| "sendgrid/sendgrid": "~6.2" | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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!"}]}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| $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