Mails : response

Responses

In the course of handling mails, developers tend to get responses of their mails. The response() method does this in the mailer tool. It simply return the responses of mails. These response is an array that includes the messages generated by the mailer and also the content of the mail itself which can be good for preview. It is important to emphasize that a mail may not look entirely similar to a preview for certain reasons as some stylesheets may not be accepted in mails.

Here is an example below
Sample: Getting mails responses
  <?php

    $mailer = new Mailer;
    
    $mailer->authorize(true);

    $mailer->server('mail.server'); 
    
    $mailer->setup([

        'client' => ['name' => 'Foo']

    ]);

    $mailer->sendmail('mail.template');
    
    if($mail->sent('online') || $mail->sent('offline')) {      

        var_dump($mailer->response()); // returns: messages

    }
    
In the example above, response() method returns the response of the mail.