%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<?php require 'vendor/autoload.php'; // If you're using Composer (recommended) // Comment out the above line if not using Composer // require("<PATH TO>/sendgrid-php.php"); // If not using Composer, uncomment the above line and // download sendgrid-php.zip from the latest release here, // replacing <PATH TO> with the path to the sendgrid-php.php file, // which is included in the download: // https://github.com/sendgrid/sendgrid-php/releases $email = new \SendGrid\Mail\Mail(); $email->setFrom("dx@sendgrid.com", "Elmer Thomas"); $email->setSubject("Sending with SendGrid is Fun"); $email->addTo("elmer.thomas@sendgrid.com", "Example User"); $email->addContent("text/plain", "and easy to do anywhere, even with PHP"); $email->addContent( "text/html", "<strong>and easy to do anywhere, even with PHP</strong>" ); $file_encoded = base64_encode(file_get_contents('./elmer-thomas.jpg')); //$file_encoded = file_get_contents('./elmer-thomas.jpg'); $email->addAttachment( $file_encoded, "image/jpg", "elmer-thomas.jpg", "attachment" ); $sendgrid = new \SendGrid(getenv('SENDGRID_API_KEY')); 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"; }