PHP code example of laspi94 / idl-mailing

1. Go to this page and download the library: Download laspi94/idl-mailing 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/ */

    

laspi94 / idl-mailing example snippets



class MailingController extends Controller
{
    public function __construct()
    {
        $this->middleware('auth');
    }

    public static function NotificarMovimiento($asunto, $datos = [], $nombre = 'Destinatario', $idPlantilla = "1")
    {
        try {
            $listadoCorreos = [
              '[email protected]'
            ];

            foreach ($listadoCorreos as $correo) {
                $email = MailingBuilder::direccionCorreo(trim($correo))
                    ->asunto($asunto)
                    ->nombre($nombre)
                    ->idPlantilla($idPlantilla)
                    ->datos($datos);

                $email->send();
            }
        } catch (\Exception $e) {
            Log::critical($e);

            return $e;
        }
    }
}