PHP Code to send email on Github - Php

Using PHP library of Sendgrid for mails

Snippet Code


  
Rate this page :
  [ 0 votes]

You can easily send mails using PHP code and Sendgrid.

<?php require_once($_SERVER['WEBGLOO_LIB_ROOT']. '/ext/sendgrid-php/SendGrid_loader.php'); set_error_handler('offline_error_handler'); $sendgrid = new SendGrid('your-sendgrid-login', 'your-sendgrid-password'); $mail = new SendGrid\Mail(); $mail->addTo('foo@gmail.com')-> setFrom('foo@bestfishingrodsreview.com')-> setSubject('Sendgrid github PHP library test')-> setText('Hello World! from sendgrid library')-> setHtml('Hello World! from sendgrid github lib'); $response = $sendgrid->web->send($mail); print_r($response); // Complete script that i used for my domain // to send mails ?>

Tags


Ask Questions

Ask Question