'Newsletter-Anmeldung bestaetigen', 'bodyHTML' => '

' . implode('

', $body) . '

', 'bodyText' => implode("\n\n", $body), 'fromAddress' => '***REMOVED***', // 'newsletter@tobias-radloff.de' 'fromName' => 'Tobias Radloffs Newsletter' ]; // check if email parameter is set if ( ! isset($_POST['email']) ) { GracefulExit($errorURL, "{$err}: Keine Emailadresse angegeben."); } // check if it's a well-formed email address $email = filter_var(trim($_POST['email'], FILTER_SANITIZE_STRING)); if ( ! filter_var($email, FILTER_VALIDATE_EMAIL)) { GracefulExit($errorURL, "{$err}: Ungültige Emailadresse {$email}"); } // check whether address is already subscribed try { $check = NotYetSubscribed($email); if ( gettype($check) == 'string' ) { GracefulExit($errorURL, "{$err}: {$check}."); } } catch (\PDOException $e) { GracefulExit($errorURL, "{$err}: {$e->getMessage()}"); } // build and add link to $confirmQuery = http_build_query(['c' => GetConfirmationHash($email), 'e' => $email]); $confirmLink = $general['site_url'] . $confirmScript . "?" . $confirmQuery; $mailContents['bodyHTML'] = str_replace('%Placeholder%', "Anmeldung bestätigen", $mailContents['bodyHTML']); $mailContents['bodyText'] = str_replace('%Placeholder%', $confirmLink, $mailContents['bodyText']); // send email try { SendEmail($email, $mailContents); } catch (Exception $e) { GracefulExit($errorURL, "{$err}: {$e->getMessage()}"); } // success $mailContents['subject'] = 'Jemand will den Newsletter abonnieren und hat gerade eine Kopie dieser Mail bekommen'; SendEmail($general['notificationAddress'], $mailContents); GracefulExit($successURL, "Anmeldung erfolgreich: Email mit Bestätigungslink wurde an {$email} versandt."); ?>