PHP code example of crs / sendgrid-symfony

1. Go to this page and download the library: Download crs/sendgrid-symfony 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/ */

    

crs / sendgrid-symfony example snippets


   $sendmail = new crs_mail();
   $sendmail->setFrom(<%SENDER-EMAIL%>);
   $sendmail->setTo(<%RECIPIENTS-EMAIL%>);
   $sendmail->setSubject(<%EMAIL-SUBJECT%>);
   $sendmail->setBody(<%EMAIL-BODY%>);
   $sendmail->setTemplate(<%TEMPLATE-ID%>);
   $sendmail->setSubsitute(array(
       '<%SUBSITUTE-1%>' => <%SUBSITUTE-1-VALUE%>,
       '<%SUBSITUTE-2%>' => <%SUBSITUTE-2-VALUE%>,
       .....
       '<%SUBSITUTE-n%>' => <%SUBSITUTE-n-VALUE%>,
   ));
   $sendmail->addAttachment(array(
       <%FILE-PATH-1%>,
       <%FILE-PATH-2%>,
       .......
       <%FILE-PATH-n%>,
   ));
   $sendmail->sendMail(<%CONTENT-TYPE%>);