src/Core/FrenchFrogsServiceProvider.php
public function bootMail()
    {
        /**
         * Mail manager
         *
         * @param string $view
         * @param array $data
         * @param array $from
         * @param array $to
         * @param string $subject
         * @param array $attach
         */
        Response::macro('mail', function($view, $data = [], $from = [], $to = [], $subject = '', $attach = []) {

            if ($from instanceof Mail\Message) {
                \Mail::send($view, $data, function (Mail\Message $message) use ($from, $attach) {

                    // Getting the generated message
                    $swift = $from->getSwiftMessage();

                    // Setting the mandatory arguments
                    $message->subject($swift->getSubject());
                    $message->from($swift->getFrom());
                    $message->to($swift->getTo());

                    // Getting the optional arguments
                    if (!empty($swift->getSender()))    { $message->sender($swift->getSender()); }
                    if (!empty($swift->getCc()))        { $message->cc($swift->getCc()); }
                    if (!empty($swift->getBcc()))       { $message->bcc($swift->getBcc()); }
                    if (!empty($swift->getReplyTo()))   { $message->replyTo($swift->getReplyTo()); }
                    if (!empty($swift->getPriority()))  { $message->priority($swift->getPriority()); }
                    if (!empty($swift->getChildren()))  {
                        foreach($swift->getChildren() as $child){
                            $message->attachData($child->getBody(),$child->getHeaders()->get('content-type')->getParameter('name'));
                        }
                    }
                });

            } else {
                \Mail::send($view, $data, function (Mail\Message $message) use ($from, $to, $subject, $attach) {
                    // Setting the mandatory arguments
                    $message->from(...$from)->subject($subject);

                    // Managing multiple to
                    foreach ($to as $mail)      { $message->to(...$mail); }
                    // Managing multiple attachment
                    foreach ($attach as $file)  { $message->attach($file); }
                });
            }
        });
    }
public function bootMail()
    {
        /**
         * Mail manager
         *
         * @param string $view
         * @param array $data
         * @param array $from
         * @param array $to
         * @param string $subject
         * @param array $attach
         */
        Response::macro('mail', function($view, $data = [], $from = [], $to = [], $subject = '', $attach = []) {

            if ($from instanceof Mail\Message) {
                \Mail::send($view, $data, function (Mail\Message $message) use ($from, $attach) {

                    // Getting the generated message
                    $swift = $from->getSwiftMessage();

                    // Setting the mandatory arguments
                    $message->subject($swift->getSubject());
                    $message->from($swift->getFrom());
                    $message->to($swift->getTo());

                    // Getting the optional arguments
                    if (!empty($swift->getSender()))    { $message->sender($swift->getSender()); }
                    if (!empty($swift->getCc()))        { $message->cc($swift->getCc()); }
                    if (!empty($swift->getBcc()))       { $message->bcc($swift->getBcc()); }
                    if (!empty($swift->getReplyTo()))   { $message->replyTo($swift->getReplyTo()); }
                    if (!empty($swift->getPriority()))  { $message->priority($swift->getPriority()); }
                    if (!empty($swift->getChildren()))  {
                        foreach($swift->getChildren() as $child){
                            $message->attachData($child->getBody(),$child->getHeaders()->get('content-type')->getParameter('name'));
                        }
                    }
                });

            } else {
                \Mail::send($view, $data, function (Mail\Message $message) use ($from, $to, $subject, $attach) {
                    // Setting the mandatory arguments
                    $message->from(...$from)->subject($subject);

                    // Managing multiple to
                    foreach ($to as $mail)      { $message->to(...$mail); }
                    // Managing multiple attachment
                    foreach ($attach as $file)  { $message->attach($file); }
                });
            }
        });
    }
public function bootMail ( ) { /**
         * Mail manager
         *
         * @param string $view
         * @param array $data
         * @param array $from
         * @param array $to
         * @param string $subject
         * @param array $attach
         */ Response :: macro ( 'mail' , function ( $ view , $ data = [ ] , $ from = [ ] , $ to = [ ] , $ subject = '' , $ attach = [ ] ) { if ( $ from instanceof Mail \ Message ) { \ Mail :: send ( $ view , $ data , function ( Mail \ Message $ message ) use ( $ from , $ attach ) { // Getting the generated message $ swift = $ from -> getSwiftMessage ( ) ; // Setting the mandatory arguments $ message -> subject ( $ swift -> getSubject ( ) ) ; $ message -> from ( $ swift -> getFrom ( ) ) ; $ message -> to ( $ swift -> getTo ( ) ) ; // Getting the optional arguments if ( ! empty ( $ swift -> getSender ( ) ) ) { $ message -> sender ( $ swift -> getSender ( ) ) ; } if ( ! empty ( $ swift -> getCc ( ) ) ) { $ message -> cc ( $ swift -> getCc ( ) ) ; } if ( ! empty ( $ swift -> getBcc ( ) ) ) { $ message -> bcc ( $ swift -> getBcc ( ) ) ; } if ( ! empty ( $ swift -> getReplyTo ( ) ) ) { $ message -> replyTo ( $ swift -> getReplyTo ( ) ) ; } if ( ! empty ( $ swift -> getPriority ( ) ) ) { $ message -> priority ( $ swift -> getPriority ( ) ) ; } if ( ! empty ( $ swift -> getChildren ( ) ) ) { foreach ( $ swift -> getChildren ( ) as $ child ) { $ message -> attachData ( $ child -> getBody ( ) , $ child -> getHeaders ( ) -> get ( 'content-type' ) -> getParameter ( 'name' ) ) ; } } } ) ; } else { \ Mail :: send ( $ view , $ data , function ( Mail \ Message $ message ) use ( $ from , $ to , $ subject , $ attach ) { // Setting the mandatory arguments $ message -> from ( ... $ from ) -> subject ( $ subject ) ; // Managing multiple to foreach ( $ to as $ mail ) { $ message -> to ( ... $ mail ) ; } // Managing multiple attachment foreach ( $ attach as $ file ) { $ message -> attach ( $ file ) ; } } ) ; } } ) ; }
Permet d'utiliser la reponse pour envoyer un mail

Cela permet de gere un email comme une page web.
Permet d utiliser la reponse pour envoyer un mail