SendGrid
API繧ュ繝シ蜿門セ
縲栗ntegrate using our Web API縲阪r驕ク謚
竊
縲靴reate Key縲
竊
譛牙柑蛹匁焔邯壹″縺ク
螳溯」
繧、繝ウ繧ケ繝医シ繝ォ
composer require sendgrid/sendgrid
繧ス繝シ繧ケ繧ウ繝シ繝
<?php
require 'vendor/autoload.php';
$email = new \SendGrid\Mail\Mail();
$email->setFrom("test@example.com", "騾∽ソ。閠");
$email->setSubject("鬘悟錐");
$email->addTo("test@example.com", "蜿嶺ソ。閠");
$email->addContent("text/plain", "譛ャ譁");
$email->addContent("text/html", "<strong>HTML譛ャ譁</strong>");
$sendgrid = new \SendGrid(getenv('荳翫〒蜿門セ励@縺蘗PI繧ュ繝シ'));
try {
縲縲$response = $sendgrid->send($email);
縲縲print $response->statusCode() . "\n";
縲縲print_r($response->headers());
縲縲print $response->body() . "\n";
} catch (Exception $e) {
縲縲echo 'Caught exception: '. $e->getMessage() ."\n";
}