/var/www/html_fr/wp-content/plugins/fluent-smtp/app/Services/Mailer/Providers/Simulator/Handler.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php

namespace FluentMail\App\Services\Mailer\Providers\Simulator;

use 
FluentMail\App\Models\Logger;
use 
FluentMail\App\Services\Mailer\BaseHandler;

class 
Handler extends BaseHandler
{
    public function 
send()
    {
        if(
$this->shouldBeLogged(true)) {
            
$atts $this->setAttributes();

            
$customHeaders $atts['custom_headers'];
            
$headers $atts['headers'];
            foreach (
$customHeaders as $customHeader) {
                
$headers[$customHeader['key']] = $customHeader['value'];
            }

            
$headers $this->phpMailer->getCustomHeaders();
            
$headers['content-type'] = $this->phpMailer->ContentType;

            
$logData = [
                
'to' => maybe_serialize($this->setRecipientsArray($this->phpMailer->getToAddresses())),
                
'from' => maybe_serialize($this->phpMailer->From),
                
'subject' => $this->phpMailer->Subject,
                
'body' => $this->phpMailer->Body,
                
'attachments' => maybe_serialize($this->phpMailer->getAttachments()),
                
'status'   => 'sent',
                
'response' => maybe_serialize(['status' => __('Email sending was simulated, No Email was sent originally''fluent-smtp')]),
                
'headers'  => maybe_serialize($headers),
                
'extra'    => maybe_serialize(['provider' => 'Simulator'])
            ];

            (new 
Logger)->add($logData);
        }

        return 
true;
    }

    protected function 
postSend()
    {
        
$returnResponse = [
            
'response' => 'OK'
        
];

        
$this->response $returnResponse;
        return 
$this->handleResponse($this->response);
    }

    public function 
setSettings($settings)
    {
        
$this->settings $settings;
        return 
$this;
    }
}