6
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SendGridでCurlコマンドを使ってメールを送信する

Last updated at Posted at 2017-10-17

準備

  • SendGridのアカウントを作成する(Azureを使用している場合はAzureポータルからも可能)
  • SendGridのポータル画面でAPI Keyを作成する(メール送信権限ありにする)

実行

API Keyと宛先アドレスの箇所を書き換えて以下のコマンドを実行する。

curl --request POST \
  --url https://api.sendgrid.com/v3/mail/send \
  --header 'Authorization: Bearer API-KEY-HERE' \
  --header 'Content-Type: application/json' \
  --data '{"personalizations": [{"to": [{"email": "TO-ADDRESS-HERE"}]}],"from": {"email": "example@example.com"},"subject": "Hello, SendGrid!","content": [{"type": "text/plain", "value": "Hi!"}]}'

参考

6
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?