Back | Home
الـ Path الحالي: /home/picotech/domains/instantly.picotech.app/public_html/app/EmailProvider
الملفات الموجودة في هذا الـ Path:
.
..
AmazonSmtp.php
ElasticApi.php
ElasticSmtp.php
MailGunApi.php
MailGunSmtp.php
SendEMail.php
SendGridApi.php
SendMailInterface.php
SendMailProcess.php
Sendmail.php
Smtp.php
SparkpostSmtp.php

مشاهدة ملف: ElasticSmtp.php

<?php

namespace App\EmailProvider;


use Illuminate\Support\Facades\Log;

class ElasticSmtp implements SendMailInterface
{
    public function message($message){
        $this->message = $message;

        return $this;
    }
    public function from($from)
    {
        $this->from = $from;
        return $this;
    }
    public function from_name($from_name)
    {
        $this->from_name = $from_name;
        return $this;
    }
    public function reply_to($reply_to)
    {
        $this->reply_to = $reply_to;
        return $this;
    }
    public function to($to)
    {
        $this->to = $to;
        return $this;
    }

    public function subject($subject)
    {
        $this->subject = $subject;
        return $this;
    }

    public function body($body)
    {
        $this->body = $body;
        return $this;
    }

    public function files($files)
    {
        $files = $this->files;
        $files_arr = [];

        foreach($files as $file){
            $files_arr = public_path('uploads/'.$file);
        }
        return $files_arr;
    }


    public function process()
    {
        try {
            $configuration = new \ElasticEmailClient\ApiConfiguration([
                'apiUrl' => 'https://api.elasticemail.com/v2/',
                'apiKey' => 'yourApiKey'
            ]);
            $client = new \ElasticEmailClient\ElasticClient($configuration);

            $client->Email->Send(
                "$this->subject",
                "$this->from",
                "$this->from_name",
                null,
                null,
                null,
                null,
                null,
                null,
                array("$this->to"),
                array(),
                array(),
                array(),
                array(),
                array(),
                null,
                null,
                null,
                "$this->body",
                null
            );
        } catch (\Exception $ex) {
            Log::info($ex->getMessage());
        }
    }

    public function errors()
    {
        // TODO: Implement errors() method.
    }
}