Add reply-to on email receipt
This commit is contained in:
parent
e8ef31d86f
commit
f45a2a1acb
@ -7,6 +7,7 @@ class Email {
|
||||
|
||||
private $subject = "";
|
||||
private $body = "";
|
||||
private $html = "";
|
||||
private $attachments = [];
|
||||
private $to = [];
|
||||
private $fromaddress = "";
|
||||
@ -17,6 +18,7 @@ class Email {
|
||||
private $smtpusername = "";
|
||||
private $smtppassword = "";
|
||||
private $smtpsecurity = "";
|
||||
private $replyto = "";
|
||||
|
||||
public function setFrom(string $address, string $name = "") {
|
||||
$this->fromaddress = $address;
|
||||
@ -35,10 +37,18 @@ class Email {
|
||||
$this->body = $body;
|
||||
}
|
||||
|
||||
public function setHtmlBody(string $html) {
|
||||
$this->html = $html;
|
||||
}
|
||||
|
||||
public function addAttachment(string $filename, string $name = "") {
|
||||
$this->attachments[$filename] = $name;
|
||||
}
|
||||
|
||||
public function setReplyTo(string $em) {
|
||||
$this->replyto = $em;
|
||||
}
|
||||
|
||||
public function addTo(string $email) {
|
||||
$this->to[] = $email;
|
||||
}
|
||||
@ -79,10 +89,24 @@ class Email {
|
||||
$mail->SMTPSecure = $this->smtpsecurity;
|
||||
}
|
||||
$mail->Port = $this->smtpport;
|
||||
$mail->isHTML(false);
|
||||
|
||||
if (empty($this->html)) {
|
||||
$mail->isHTML(false);
|
||||
$mail->CharSet = "text/plain; charset=UTF-8;";
|
||||
$mail->Body = $this->body;
|
||||
} else {
|
||||
$mail->isHTML(true);
|
||||
$mail->CharSet = "text/html; charset=UTF-8;";
|
||||
$mail->Body = $this->html;
|
||||
$mail->AltBody = $this->body;
|
||||
}
|
||||
|
||||
$mail->setFrom($this->fromaddress, $this->fromname);
|
||||
|
||||
if (!empty($this->replyto)) {
|
||||
$mail->addReplyTo($this->replyto);
|
||||
}
|
||||
|
||||
foreach ($this->to as $to) {
|
||||
$mail->addAddress($to);
|
||||
}
|
||||
|
||||
@ -192,6 +192,9 @@ try {
|
||||
$emailsettings = $_SETTINGS["email"];
|
||||
$mail->setSMTP($emailsettings["server"], $emailsettings["port"], true, $emailsettings["user"], $emailsettings["password"], $emailsettings["security"]);
|
||||
$mail->setFrom($emailsettings["user"], "CertifiedFromHome.com");
|
||||
if (!empty($emailsettings["replyto"])) {
|
||||
$mail->setReplyTo($emailsettings["replyto"]);
|
||||
}
|
||||
$mail->addTo($shipment->from_address->email);
|
||||
$mail->setSubject("Your CertifiedFromHome Receipt");
|
||||
$body = "Thanks for using CertifiedFromHome.com!\r\nYour card has been charged a total of $" . number_format($price, 2) . ".\r\n";
|
||||
|
||||
@ -9,6 +9,7 @@ $_SETTINGS = [
|
||||
"server" => "mail.netsyms.net",
|
||||
"port" => 587,
|
||||
"user" => "noreply@netsyms.com",
|
||||
"replyto" => "reply@netsyms.com",
|
||||
"password" => "",
|
||||
"security" => "tls"
|
||||
],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user