VERO/sendconfirmationmail.php
2026-03-04 10:12:09 +01:00

213 lines
7.7 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// Include config file
require_once "config.php";
$config = parse_ini_file("config.ini", true) ;
$baseURL = $config['base']['URL'];
session_start();
$firstname = isset($_SESSION['firstname']) ? $_SESSION['firstname'] : "Roland";
$lastname = isset($_SESSION['lastname']) ? $_SESSION['lastname'] : "Keck";
$email = isset($_SESSION['email']) ? $_SESSION['email'] : "roland.keck@conlicom.de";
$userToken = isset($_SESSION['userToken']) ? $_SESSION['userToken'] : "48cdd7806d36d7cfaf191925962ec448d41d07373d8208b2bfada062020e7e65";
$replyto = "noreply@bibb-service.de";
$verification_link =$baseURL . "/verify.php?token=" . $userToken;
$subject = '=?UTF-8?B?' . base64_encode('Registrierung im VET Repository: Bitte bestätigen Sie Ihre E-Mail-Adresse') . '?=';
define("DEFCALLBACKMAIL", $replyto); // Will be shown as "from".
// Mailtext as HTML (necessary because of the links used in the Mail)
$html = "<html>
<head>
<meta charset='UTF-8'>
<title>Registrierung im VET Repository: Bitte bestätigen Sie Ihre E-Mail-Adresse</title>
</head>
<body style='font-family: Arial, sans-serif; font-size: 14px;'>";
//falls doch noch einmal LOGO benötigt wird
// <img src='vet_repository.png' width='85' height='30' alt='VET Repository Logo'>
// <p>&nbsp;</p>
$html .= "
<p>Herzlich willkommen in unserem VET Repository, {$firstname} {$lastname}, </p>
<p>bitte bestätigen Sie Ihre E-Mail-Adresse, indem Sie diesen <a href='{$verification_link}'>Link</a> anklicken.
</p>
<p>Sollte der Link nicht funktionieren, kopieren Sie den Link {$verification_link} in die Adresszeile Ihres Browsers.</p>
<p>(Falls Sie sich nicht im VET Repository registriert haben sollten, können Sie diese E-Mail ignorieren).</p>
<p>Nach erfolgreicher Bestätigung der Freischaltung können Sie sich mit Ihrer E-Mail-Adresse und Ihrem Passwort über den Button <a href='{$baseURL}/login.php'>\"Login\"</a> anmelden und mit der Veröffentlichung Ihrer Publikation in unserem VET Repository beginnen.</p>
<p>Alle wichtigen Informationen rund um das VET Repository finden Sie auf der Informationsseite <a href='https://www.bibb.de/de/repository'> Publizieren im VET Repository</a>.
<p>Bei weiteren Fragen stehen wir Ihnen gerne unter der Mailadresse <a href=\"mailto:repository@bibb.de\">repository@bibb.de</a> zur Verfügung.<br>
<p>Ihr Team des VET Repository</p>
<p>
<small>
--
<br>
Bundesinstitut für Berufsbildung
<br>
Stabsstelle „Publikationen und wissenschaftliche Informationsdienste“
<br>
Federal Institute for Vocational Education and Training (BIBB)
<br>
Strategic office “Publications and Scientific Information Services“
<br>
Friedrich-Ebert-Allee 114 - 116
<br>
D53113 Bonn
<br><br>
<a href=\"mailto:repository@bibb.de\">repository@bibb.de</a>
<br>
<a href=\"https://www.bibb.de\">www.bibb.de</a>
<br>
<a href=\"https://www.bibb.de/repository\">www.bibb.de/repository</a>
<br>
<a href=\"https://www.vet-repository.info\">www.vet-repository.info</a>
<br>
</small>
</body>
</html>
";
// now let`s generate the mail including all links, images, etc.
$final_msg = preparehtmlmail($html); // give a function your html*
$message = $final_msg['multipart'];
$headers = $final_msg['headers'];
// send the mail using sendmail as underlying service
mail($email, $subject, $message, $headers);
// prepare email with all images from html attached (will be presented embedded depending on the Mailclient used
function preparehtmlmail($html) {
preg_match_all('~<img.*?src=.([\/.a-z0-9:_-]+).*?>~si',$html,$matches);
$i = 0;
$paths = array();
foreach ($matches[1] as $img) {
$img_old = $img;
if(strpos($img, "http://") === false || strpos($img, "https://")) {
$uri = parse_url($img);
$paths[$i]['path'] = $_SERVER['DOCUMENT_ROOT'].$uri['path'];
$content_id = md5($img);
$html = str_replace($img_old,'cid:'.$content_id,$html);
// print_r($html);
$paths[$i++]['cid'] = $content_id;
}
}
$boundary = "--".md5(uniqid(time()));
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\n";
$headers .= "From: ".DEFCALLBACKMAIL."\r\n";
$multipart = '';
$multipart .= "--$boundary\n";
$kod = 'utf-8';
$multipart .= "Content-Type: text/html; charset=$kod\n";
$multipart .= "Content-Transfer-Encoding: Quot-Printed\n\n";
$multipart .= "$html\n\n";
foreach ($paths as $path) {
if(file_exists($path['path']))
$fp = fopen($path['path'],"r");
if (!$fp) {
return false;
}
$imagetype = substr(strrchr($path['path'], '.' ),1);
$file = fread($fp, filesize($path['path']));
fclose($fp);
$message_part = "";
switch (strtolower($imagetype)) {
case 'png':
$message_part .= "Content-Type: image/png";
break;
case 'jpg':
case 'jpeg':
$message_part .= "Content-Type: image/jpeg";
break;
case 'gif':
$message_part .= "Content-Type: image/gif";
break;
}
$p = $path['path'];
$message_part .= "; file_name = \"$p\"\n";
$message_part .= 'Content-ID: <'.$path['cid'].">\n";
$message_part .= "Content-Transfer-Encoding: base64\n";
$message_part .= "Content-Disposition: inline; filename = \"".basename($path['path'])."\"\n\n";
$message_part .= chunk_split(base64_encode($file))."\n";
$multipart .= "--$boundary\n".$message_part."\n";
}
$multipart .= "--$boundary--\n";
return array('multipart' => $multipart, 'headers' => $headers);
}
?>
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<title>Login</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css">
<link href="css/bibb.css" media="all" rel="stylesheet" type="text/css">
<style>
html, body {
height: 100%;
}
.stickywrapper {
min-height: 60vh;
display: flex;
flex-direction: column;
}
.content {
flex: 1;
}
</style>
</head>
<body>
<?php include "templates/headerLogin.php"; ?>
<div class="stickywrapper">
<!-- Hauptinhalt der Seite -->
<div class="content">
<div class="container my-5">
<div id="confirmationScreen" class="wrapperconfirmation ml-10 shadow p-3 mb-5 bg-box rounded align-items-center">
<h4>E-Mail-Bestätigung</h4>
<div class="row">
Hallo <?php echo $firstname ." " .$lastname ?>,
</div>
<div class="row"></div>
<div class="row">
wir haben an "<?php echo $email ?>" eine E-Mail mit dem Betreff "Registrierung im VET Repository: Bitte bestätigen Sie Ihre E-Mail-Adresse" gesendet. Bitte klicken Sie auf den Link in dieser E-Mail, damit wir Ihr Publikationskonto anlegen können.
</div>
<div class="row">
Sollten Sie diese E-Mail nicht innerhalb kurzer Zeit erhalten, prüfen Sie bitte Ihren Spamordner. Ist die E-Mail auch dort nicht angekommen, melden Sie sich bitte über unser <a href="https://www.bibb.de/dienst/kontakt/de/kontaktformular.php?maid=4841" target="_blank" rel="noopener noreferrer" >Kontaktformular</a>.
</div>
</div>
</div>
</div>
</div>
<?php include "templates/stickyfooter.php" ?>
</body>
</html>