PHP 7.4.33
Preview: Sendmail.php Size: 5.23 KB
/home/justbyquicklly-old/justbyquicklly/www/include/Sendmail.php

<?php

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;

class Sendemail {

    //Configuration
    private $StoreCount;
    private $ToEmailAddress;
    private $Subject;
    private $EmailBody;
    private $OrderID;
    private $ZipCode;
    private $FromEmail;
    private $BCC;
    private $ReplyTo;
    private $UserName;
    private $EmailPassword;

    public function __construct() {
        $this->setUsername('AKIA4G5EDNFJILKYIZIG');
        $this->setEmailPassword('BFTpdLpxcDg6wp5baapGyR8jgfjNZZ9u9M5jbimXZVDr');
    }

    /**
     * @param mixed $UserName
     */
    private function setFromEmail($FromEmail) {
        $this->FromEmail = $FromEmail;
    }

    /**
     * @param mixed $FromEmail
     */
    private function setUsername($Username) {
        $this->UserName = $Username;
    }

    /**
     * @param mixed $ToEmailAddress
     */
    private function setToEmailAddress($ToEmailAddress) {
        $this->ToEmailAddress = $ToEmailAddress;
    }

    /*
     * @param mixed $EmailPassword
     */

    private function setEmailPassword($EmailPassword) {
        $this->EmailPassword = $EmailPassword;
    }

    /**
     * @param mixed $ReplyTo
     */
    private function setReplyTo($ReplyTo) {
        $this->ReplyTo = $ReplyTo;
    }

    /**
     * @param mixed $BCC
     */
    private function setBCC($BCC) {
        $this->BCC = $BCC;
    }

    /**
     * @param mixed $EmailBody
     */
    private function setEmailBody($EmailBody) {
        $this->EmailBody = $EmailBody;
    }

    /**
     * @param mixed $Subject
     */
    private function setSubject($Subject) {
        $this->Subject = $Subject;
    }

    public function sendEmail($fromEmail, $fromName, $toEmail, $toName, $subject, $emailBody, $bcc, $replyTo) {

        //require 'vendor/autoload.php';
        require 'vendor/autoload.php';
        $mail = new PHPMailer(true);

        $configurationSet = 'quicklly';
        try {
            //Server settings
			
            //$mail->SMTPDebug = SMTP::DEBUG_SERVER;                      // Enable verbose debug output
            $mail->isSMTP();                                            // Send using SMTP
            $mail->Host = 'email-smtp.us-east-2.amazonaws.com'; // Set the SMTP server to send through
            //$host = 'email-smtp.us-east-2.amazonaws.com'; 
            $mail->SMTPAuth = true;                                   // Enable SMTP authentication
            $mail->Username = $this->getUserName();                     // SMTP username
            $mail->Password = $this->getEmailPassword();                           // SMTP password
            //$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //ENCRYPTION_STARTTLS;         // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
            $mail->SMTPSecure = 'tls';
			$mail->addCustomHeader('X-SES-CONFIGURATION-SET', $configurationSet);
			$mail->Port = 587;                                    // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above
            //Recipients
            $mail->setFrom($fromEmail, $fromName);
            $mail->addAddress($toEmail, $toName);     // Add a recipient
            if($bcc){
            foreach(explode(",",$bcc) as $emailBcc){
              $mail->addBCC($emailBcc);
            } 
			}
            $mail->addReplyTo($replyTo);

            // Content
            $mail->isHTML(true);                                  // Set email format to HTML
            $mail->Subject = $subject;
            $mail->Body = $emailBody;
            //$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
			//$mail->SMTPDebug  = 2;
            $mail->send();
         echo 'Message has been sent';
        } catch (Exception $e) {
             echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
        }
		return true;
    }

    /**
     * @return mixed
     */
    private function getEmailPassword() {
        return $this->EmailPassword;
    }

    /**
     * @return mixed
     */
    private function getUserName() {
        return $this->UserName;
    }

    /**
     * @return mixed
     */
    private function getFromEmail() {
        return $this->FromEmail;
    }

    /**
     * @return mixed
     */
    private function getFromEmailPassword() {
        return $this->FromEmailPassword;
    }

    /**
     * @return mixed
     */
    private function getToEmailAddress() {
        return $this->ToEmailAddress;
    }

    /**
     * @return mixed
     */
    private function getReplyTo() {
        return $this->ReplyTo;
    }

    /**
     * @return mixed
     */
    private function getBCC() {
        return $this->BCC;
    }

    /**
     * @return mixed
     */
    private function getSubject() {
        return $this->Subject;
    }

    /**
     * @return mixed
     */
    private function getEmailBody() {
        return $this->EmailBody;
    }

    /**
     * @param mixed $FromEmailPassword
     */
    private function setFromEmailPassword($FromEmailPassword) {
        $this->FromEmailPassword = $FromEmailPassword;
    }

}

?>

Directory Contents

Dirs: 0 × Files: 6

Name Size Perms Modified Actions
3.47 KB lrwxrwxr-x 2024-09-20 17:35:02
Edit Download
14.24 KB lrwxrwxr-x 2024-09-19 08:57:28
Edit Download
27.21 KB lrwxrwxr-x 2024-09-19 08:57:28
Edit Download
26.46 KB lrwxrwxr-x 2024-09-19 08:57:28
Edit Download
5.23 KB lrwxrwxr-x 2024-10-07 12:57:52
Edit Download
1.92 KB lrwxrwxr-x 2024-09-19 08:57:28
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).