MOON
Server: Apache
System: Linux e2e-78-16.ssdcloudindia.net 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
User: imensosw (1005)
PHP: 8.0.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/imensosw/www/imenso.co/dev/arabeasy/app/Sendgrid.php
<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class Sendgrid extends Authenticatable
{
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        
    ];


    public static function send_mail( $subject , $template_id , $sub , $email , $fname )
    {
          $js = array(
            'sub' => $sub,
            'filters' => array('templates' => array('settings' => array('enable' => 1, 'template_id' => $template_id)))
          );
           
          $params = array(
              'to'        => $email,
              'toname'    => $fname,
              'from'      => "admin@wipit.co",
              'fromname'  => "Work-in-Progress",
              'subject'   => $subject,
              'text'      => "",
              'html'      => " ",
              'x-smtpapi' => json_encode($js),
            );
          
          $session = curl_init('https://api.sendgrid.com/'.'api/mail.send.json');
          curl_setopt($session, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
          curl_setopt($session, CURLOPT_HTTPHEADER, array('Authorization: Bearer '. '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'));
          curl_setopt ($session, CURLOPT_POST, true);
          curl_setopt ($session, CURLOPT_POSTFIELDS, $params);
          curl_setopt($session, CURLOPT_HEADER, false);
          curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
          $response = curl_exec($session);
          curl_close($session);
    }

  
}