PHP code example of tparcina / qsendgrid

1. Go to this page and download the library: Download tparcina/qsendgrid library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tparcina / qsendgrid example snippets




use QAlliance\QSendgrid;

// Create new QSendgrid object
$qs = new QSendgrid('NO_REPLY_EMAIL', 'SENDGRID_API_KEY');

// Send email to given address with given subject and content, returns bool
$result = $qs->send('[email protected]', 'My Subject', '<h1>This is a QSendgrid test email.</h1>');



use QAlliance\QSendgrid;

$attachmentUrls = [
	'./src/attachments/sample1.jpg',
	'./src/attachments/sample2.jpg'
];

// Create new QSendgrid object
$qs = new QSendgrid('NO_REPLY_EMAIL', 'SENDGRID_API_KEY');

// Send email to given address with given subject and content, returns bool
$result = $qs->send('[email protected]', 'My Subject', '<h1>This is a QSendgrid test email with attachments.</h1>', $attachmentUrls);

// Send email with both html and text/plain content, returns bool
$result = $qSendgrid->sendWithTextPlain('[email protected]', 'My Subject', '<h1>This is a QSendgrid test email with plain text.</h1>', 'This is a QSendgrid test email with plain text', null, 'From Name');

 vendor/bin/phpunit --bootstrap phpunit.bootstrap.php