Send email receipts

master
Skylar Ittner 3 years ago
parent 756c889d98
commit b44b365c70

@ -2,7 +2,7 @@
"context": {
"site_title": "Certified from Home",
"site_root": "https://certifiedfromhome.com/",
"stripe_pk": "pk_live_RgpadCo1LIIkfyUsY47VhUq6",
"stripe_pk": "pk_live_51J6qFXCa1Fboir5UXRYBZ0dQVL43LpQ8NpT2bjpyrzSpdZhbpmJ9FFtMO7cBrGXd0fC4SZxqg7ZXD70DNF7998Dm003g81nrxs",
"navigation": [
{
"title": "Home",

@ -111,6 +111,7 @@
{{> statelist}}
</select>
<input type="text" name="from_zip" placeholder="Your ZIP Code" required />
<input type="email" name="from_email" placeholder="Your Email Address" required />
<br />
<h3>Options:</h3>

@ -34,6 +34,7 @@ try {
"city" => $_REQUEST["from_city"],
"state" => $_REQUEST["from_state"],
"zip" => $_REQUEST["from_zip"],
"email" => $_REQUEST["from_email"],
"country" => "US"
]);
@ -54,6 +55,8 @@ try {
"weight" => 3.5
]);
$shipmentinfo["carrier_accounts"] = ["ca_fe31a7e4fcf24438b8cdfb74541c7094"]; // USPS
if ($_REQUEST["postagetype"] == "certified") {
$shipmentinfo["options"]["certified_mail"] = true;
} else if ($_REQUEST["postagetype"] == "certified_receipt") {

@ -82,6 +82,24 @@ try {
// get paid
$intent->capture();
try {
$mail = new Email();
$emailsettings = $_SETTINGS["email"];
$mail->setSMTP($emailsettings["server"], $emailsettings["port"], true, $emailsettings["user"], $emailsettings["password"], $emailsettings["security"]);
$mail->setFrom("certifiedfromhome@helena.express", "CertifiedFromHome.com");
$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";
if (!empty($shipment->options->certified_mail)) {
$body .= "You can track your letter with this tracking code: " . $shipment->tracking_code . "\r\n";
}
$body .= "If you need any help, just reply to this email. Thanks again!";
$mail->setBody($body);
$mail->send();
} catch (Exception $ex) {
}
header("Content-Type: application/json");
exit(json_encode([
"status" => "OK",

@ -4,4 +4,11 @@ $_SETTINGS = [
"debug" => false,
"easypost_key" => "",
"stripe_sk" => "",
"email" => [
"server" => "mail.netsyms.net",
"port" => 587,
"user" => "noreply@netsyms.com",
"password" => "",
"security" => "tls"
],
];

Loading…
Cancel
Save