phpmailer

This commit is contained in:
2023-02-08 00:59:52 +01:00
parent 1644fede7f
commit 6a7569147e
5 changed files with 69 additions and 32 deletions

View File

@ -62,14 +62,24 @@ if (!filter_var($toEmail, FILTER_VALIDATE_EMAIL))
return;
}
$subject = 'Dog Found ' . $name .' '. $qr_id;
$subject = 'Tier gefunden: ' . $name .' ID: '. $qr_id;
// $headers =
// array(
// 'From' => $fromEmail,
// 'Cc' => $fromEmail,
// 'Bcc' => 'dog@hope-fly.de'
// );
$headers = 'From: ' . $fromEmail . "\r\n";
$headers .= 'Cc: ' . $fromEmail . "\r\n";
$headers .= 'Bcc: ' . 'dog@hope-fly.de' . "\r\n\r\n";
//var_dump($headers);
$headers[] = 'From: '. $fromEmail;
$headers[] = 'Cc: '. $fromEmail;
$headers[] = 'Bcc: dog@hope-fly.de';
try
{
$ret = mail($toEmail,$subject,$msg,implode("\r\n", $headers));
$ret = mail($toEmail, $subject, $msg, $headers);
if($ret)
{
$result = new CMsg(1, 200, "Email send successfully.");
@ -99,7 +109,10 @@ function storeEmail()
$sql = "INSERT INTO contact_emails (dogs_id, from_email, msg) VALUES (?,?,?)";
$conn->prepare($sql)->execute([$dogRes->data['id'], $fromEmail, $msg]); // throw PDO::exception when failed
}
else
{
throw new Exception("qr_id: " . $qr_id . " :: " . $dogRes->message);
}
return $dogRes;
}
?>