edit message mail and forms
All checks were successful
Build and Deploy Hugo Site / buildAndDeploy (push) Successful in 59s
All checks were successful
Build and Deploy Hugo Site / buildAndDeploy (push) Successful in 59s
This commit is contained in:
parent
d9d3dc8897
commit
a2f4a0a51b
4 changed files with 128 additions and 110 deletions
|
|
@ -73,16 +73,16 @@ bestellformular = true
|
|||
<div><br><br>
|
||||
<h5>Welche Erweiterungen möchten Sie hinzubuchen?</h5><br>
|
||||
<div id="checkbox-group">
|
||||
<input type="checkbox" id="zusatzmodul-pop2" name="zusatzmodul-pop2" value="Ja">
|
||||
<input type="checkbox" id="zusatzmodul-pop2" name="zusatzmodul-pop2" value="Zusatzmodul POP2: Bereitstellung, einmalig 438.00 CHF; Jährliche Lizenzkosten 42.00 CHF">
|
||||
<label for="zusatzmodul-pop2">Zusatzmodul POP2: Bereitstellung, einmalig 438.00 CHF; Jährliche Lizenzkosten 42.00 CHF</label>
|
||||
<br>
|
||||
<input type="checkbox" id="zusatzmodul-materialverwaltung" name="zusatzmodul-materialverwaltung" value="Ja">
|
||||
<input type="checkbox" id="zusatzmodul-materialverwaltung" name="zusatzmodul-materialverwaltung" value="Zusatzmodul Material: Bereitstellung, einmalig 342.00 CHF; Jährliche Lizenzkosten 138.00 CHF">
|
||||
<label for="zusatzmodul-materialverwaltung">Zusatzmodul Material: Bereitstellung, einmalig 342.00 CHF; Jährliche Lizenzkosten 138.00 CHF</label>
|
||||
<br>
|
||||
<input type="checkbox" id="zusatzmodul-qr-code" name="zusatzmodul-qr-code" value="Ja">
|
||||
<input type="checkbox" id="zusatzmodul-qr-code" name="zusatzmodul-qr-code" value="Zusatzmodul QR-Code: Bereitstellung, einmalig pro Instanz 50.00 CHF; Jährliche Lizenzkosten 36.00 CHF">
|
||||
<label for="zusatzmodul-qr-code">Zusatzmodul QR-Code: Bereitstellung, einmalig pro Instanz 50.00 CHF; Jährliche Lizenzkosten 36.00 CHF</label>
|
||||
<br>
|
||||
<input type="checkbox" id="zusatzmodul-perigon" name="zusatzmodul-perigon" value="Ja">
|
||||
<input type="checkbox" id="zusatzmodul-perigon" name="zusatzmodul-perigon" value="Zusatzmodul Perigon: Bereitstellung, einmalig 50.00 CHF">
|
||||
<label for="zusatzmodul-perigon">Zusatzmodul Perigon: Bereitstellung, einmalig 50.00 CHF</label>
|
||||
</div>
|
||||
<div><br><br>
|
||||
|
|
|
|||
|
|
@ -117,8 +117,9 @@ bestellformular = true
|
|||
|
||||
<div>
|
||||
<select id="zusatzmodul-pop2" name="zusatzmodul-pop2" required >
|
||||
<option value="">Nein</option>
|
||||
<option value="Zusatzmodul POP2 ">Ja, Zusatzmodul POP2 für CHF 1'560</option>
|
||||
<option value="Nein">Nein</option>
|
||||
<option value="Zusatzmodul POP2: Jährliche Lizenzkosten 240.00 CHF; Bereitstellung, einmalig 1'560.00 CHF">Ja, Zusatzmodul POP2: Jährliche Lizenzkosten 240.00 CHF; Bereitstellung, einmalig 1'560.00 CHF</option>
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
|
@ -126,8 +127,8 @@ bestellformular = true
|
|||
|
||||
<div>
|
||||
<select id="zusatzmodul-qrcode" name="zusatzmodul-qr-code" required >
|
||||
<option value="">Nein</option>
|
||||
<option value="Zusatzmodul QRcode ">Ja, Zusatzmodul QRcode für 240.00 CHF Jährlich, Aufschaltgebühr einmalig 200.00 CHF</option>
|
||||
<option value="Nein">Nein</option>
|
||||
<option value="Zusatzmodul QR-Code für 240.00 CHF Jährlich, Aufschaltgebühr einmalig 200.00 CHF">Ja, Zusatzmodul QR-Code für 240.00 CHF Jährlich, Aufschaltgebühr einmalig 200.00 CHF</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
|
@ -135,12 +136,12 @@ bestellformular = true
|
|||
|
||||
<div>
|
||||
<select id="zusatzmodul-perigon" name="zusatzmodul-perigon" required >
|
||||
<option value="">Nein</option>
|
||||
<option value="Zusatzmodul Perigon ">Ja, Zusatzmodul Perigon, Aufschaltgebühr einmalig 200.00 CHF</option>
|
||||
<option value="Nein">Nein</option>
|
||||
<option value="Zusatzmodul Perigon, Aufschaltgebühr einmalig 200.00 CHF">Ja, Zusatzmodul Perigon, Aufschaltgebühr einmalig 200.00 CHF</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label for="anmerkung">Anmerkung</label>
|
||||
<label for="anmerkung">Bemerkung</label>
|
||||
<textarea id="anmerkung" name="anmerkung" rows="4"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
header('Access-Control-Allow-Origin: *'); // Allow access from any origin
|
||||
header('Content-Type: application/json'); // Set the response content type to JSON
|
||||
header('Access-Control-Allow-Methods: POST'); // Allow only POST requests
|
||||
|
|
@ -12,71 +13,81 @@ use PHPMailer\PHPMailer\PHPMailer;
|
|||
$mail = new PHPMailer(true);
|
||||
mb_internal_encoding("UTF-8");
|
||||
|
||||
try {
|
||||
// Receive and validate input data using filter_input()
|
||||
$name = strip_tags(trim(filter_input(INPUT_POST, 'name') . ' ' . filter_input(INPUT_POST, 'vorname'))); // Add filter_input(INPUT_POST, 'nachname') to $name
|
||||
$lang = ( isset($_POST['sprache']) && $_POST['sprache'] == "FR" ? "FR" : "DE" );
|
||||
$email = filter_var(trim(filter_input(INPUT_POST, 'email')), FILTER_SANITIZE_EMAIL);
|
||||
$subject = strip_tags(trim(filter_input(INPUT_POST, 'formularart')));
|
||||
// Construct the message using the function from message.php
|
||||
$message = constructMessage();
|
||||
if (empty($name) || !filter_var($email, FILTER_VALIDATE_EMAIL) || empty($message)) {
|
||||
// Invalid input
|
||||
throw new Exception('Ungültige Eingabedaten.');
|
||||
}
|
||||
// SMTP von Verua verwenden
|
||||
// Server settings
|
||||
//$mail->SMTPDebug = SMTP::DEBUG_SERVER; // Enable this for detailed debugging
|
||||
$mail->isSMTP(); // Use SMTP
|
||||
$mail->Host = 'ophelia.kreativmedia.ch'; // Set SMTP server
|
||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
||||
$mail->Username = 'order@verua.swiss'; // SMTP username
|
||||
$mail->Password = 'Ont2J0s1qQYvX9TQrsx0nQv4Spuhha'; // SMTP password
|
||||
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; // Enable encryption
|
||||
$mail->Port = 465; // TCP port for the connection
|
||||
|
||||
// Recipients
|
||||
$mail->setFrom('order@verua.swiss', 'VeruA AG'); // Sender address
|
||||
$mail->addAddress('support@verua.ch', 'VeruA AG'); // Add another recipient
|
||||
try
|
||||
{
|
||||
// Receive and validate input data using filter_input()
|
||||
$name = strip_tags(trim(filter_input(INPUT_POST, 'name') . ' ' . filter_input(INPUT_POST, 'vorname'))); // Add filter_input(INPUT_POST, 'nachname') to $name
|
||||
$lang = ( isset($_POST['sprache']) && $_POST['sprache'] == "FR" ? "FR" : "DE" );
|
||||
$email = filter_var(trim(filter_input(INPUT_POST, 'email')), FILTER_SANITIZE_EMAIL);
|
||||
// if order is from Organisation, use email on contact-person too
|
||||
if (isset($_POST['ansprechpartner_email']) && $_POST['ansprechpartner_email'] != "" )
|
||||
{
|
||||
$emailContact = filter_var(trim(filter_input(INPUT_POST, 'ansprechpartner_email')), FILTER_SANITIZE_EMAIL);
|
||||
}
|
||||
$subject = strip_tags(trim(filter_input(INPUT_POST, 'formularart')));
|
||||
// Construct the message using the function from message.php
|
||||
$message = constructMessage();
|
||||
if (empty($name) || !filter_var($email, FILTER_VALIDATE_EMAIL) || empty($message))
|
||||
{
|
||||
// Invalid input
|
||||
throw new Exception('Ungültige Eingabedaten.');
|
||||
}
|
||||
// SMTP von Verua verwenden
|
||||
// Server settings
|
||||
//$mail->SMTPDebug = SMTP::DEBUG_SERVER; // Enable this for detailed debugging
|
||||
$mail->isSMTP(); // Use SMTP
|
||||
$mail->Host = 'ophelia.kreativmedia.ch'; // Set SMTP server
|
||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
||||
$mail->Username = 'order@verua.swiss'; // SMTP username
|
||||
$mail->Password = 'Ont2J0s1qQYvX9TQrsx0nQv4Spuhha'; // SMTP password
|
||||
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; // Enable encryption
|
||||
$mail->Port = 465; // TCP port for the connection
|
||||
// Recipients
|
||||
$mail->setFrom('order@verua.swiss', 'VeruA AG'); // Sender address
|
||||
$mail->addAddress('support@verua.ch', 'VeruA AG'); // Add another recipient
|
||||
// $mail->addBCC('ah@mediendesign-hnida.de'); // Add bounce email address as BCC
|
||||
$mail->addBCC('rabe@verua.swiss'); // Add bounce email address as BCC
|
||||
|
||||
|
||||
// Content Mail to support
|
||||
$mail->isHTML(true); // Email in HTML format
|
||||
$mail->CharSet = 'UTF-8';
|
||||
$encodedSubject = mb_encode_mimeheader($subject, "UTF-8", "Q");
|
||||
$mail->Subject = $encodedSubject;
|
||||
$mail->addBCC('rabe@verua.swiss'); // Add bounce email address as BCC
|
||||
// Content Mail to support
|
||||
$mail->isHTML(true); // Email in HTML format
|
||||
$mail->CharSet = 'UTF-8';
|
||||
$encodedSubject = mb_encode_mimeheader($subject, "UTF-8", "Q");
|
||||
$mail->Subject = $encodedSubject;
|
||||
// $mail->Body = nl2br(htmlspecialchars($message));
|
||||
$mail->Body = $message;
|
||||
$mail->AltBody = $message;
|
||||
$mail->Body = $message;
|
||||
$mail->AltBody = $message;
|
||||
|
||||
// Send email
|
||||
if ($mail->send()) {
|
||||
// Success response
|
||||
echo json_encode(['success' => true, 'message' => 'Nachricht wurde gesendet.']);
|
||||
http_response_code(200);
|
||||
// Send email
|
||||
if ($mail->send())
|
||||
{
|
||||
// Success response
|
||||
echo json_encode(['success' => true, 'message' => 'Nachricht wurde gesendet.']);
|
||||
http_response_code(200);
|
||||
|
||||
// Send a second email to the customer
|
||||
$customerEmail = $email;
|
||||
$customerSubject = ($lang == "DE" ? 'Danke für Ihre Bestellung bei der VeruA AG' : 'Merci pour votre commande chez VeruA AG' );
|
||||
$encodedSubject = mb_encode_mimeheader($customerSubject, "UTF-8", "Q");
|
||||
// Send a second email to the customer
|
||||
$customerEmail = $email;
|
||||
$customerSubject = ($lang == "DE" ? 'Danke für Ihre Bestellung bei der VeruA AG' : 'Merci pour votre commande chez VeruA AG' );
|
||||
$encodedSubject = mb_encode_mimeheader($customerSubject, "UTF-8", "Q");
|
||||
|
||||
$customerMessage = constructCustomerMessage($message, $lang, $name);
|
||||
$customerMessage = constructCustomerMessage($message, $lang, $name);
|
||||
|
||||
$mail->clearAddresses();
|
||||
$mail->ClearBCCs();
|
||||
$mail->addAddress($customerEmail);
|
||||
$mail->Subject = $encodedSubject;
|
||||
$mail->clearAddresses();
|
||||
$mail->ClearBCCs();
|
||||
$mail->addAddress($customerEmail);
|
||||
if ( isset($emailContact) )
|
||||
{
|
||||
$mail->addAddress($customerEmail);
|
||||
}
|
||||
$mail->Subject = $encodedSubject;
|
||||
// $mail->Body = nl2br(htmlspecialchars($customerMessage));
|
||||
$mail->Body = $customerMessage;
|
||||
$mail->Body = $customerMessage;
|
||||
// $mail->AltBody = htmlspecialchars($customerMessage);
|
||||
$mail->AltBody = $customerMessage;
|
||||
$mail->AltBody = $customerMessage;
|
||||
|
||||
$mail->send();
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
// Error response if an exception occurs
|
||||
echo json_encode(['success' => false, 'message' => "Nachricht konnte nicht gesendet werden. Mailer Error: {$mail->ErrorInfo}"]);
|
||||
$mail->send();
|
||||
}
|
||||
} catch (Exception $e)
|
||||
{
|
||||
// Error response if an exception occurs
|
||||
echo json_encode(['success' => false, 'message' => "Nachricht konnte nicht gesendet werden. Mailer Error: {$mail->ErrorInfo}"]);
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -153,47 +153,53 @@ function constructMessage()
|
|||
$message .= "</b><br/>" . $wochenbett . "<br/></p>";
|
||||
}
|
||||
|
||||
// // Form inputs von Organisation Zusatzmodule
|
||||
// $zusatzmodulDienstplan = filter_input(INPUT_POST, 'zusatzmodul-dienstplan');
|
||||
// if (isset($zusatzmodulDienstplan))
|
||||
// {
|
||||
// $message .= "Zusatzmodul Dienstplan: " . "<br/>" . $zusatzmodulDienstplan . "<br/><br/>";
|
||||
// }
|
||||
//
|
||||
// $zusatzmodulTourenplan = filter_input(INPUT_POST, 'zusatzmodul-tourenplan');
|
||||
// if (isset($zusatzmodulTourenplan))
|
||||
// {
|
||||
// $message .= "Zusatzmodul Tourenplan: " . "<br/>" . $zusatzmodulTourenplan . "<br/><br/>";
|
||||
// }
|
||||
//
|
||||
// // Form inputs von Zusatzmodule Freiberufliche
|
||||
// $zusatzmodulPop2 = filter_input(INPUT_POST, 'zusatzmodul-pop2');
|
||||
// if (isset($zusatzmodulPop2))
|
||||
// {
|
||||
// $message .= "Zusatzmodul POP2: Jährliche Lizenzkosten 42.00 CHF; Bereitstellung, einmalig 438.00.00 CHF" . "<br/>";
|
||||
// }
|
||||
//
|
||||
// $zusatzmodulMaterialverwaltung = filter_input(INPUT_POST, 'zusatzmodul-materialverwaltung');
|
||||
// if (isset($zusatzmodulMaterialverwaltung))
|
||||
// {
|
||||
// $message .= ( $lang == "FR" ? "Module supplémentaire gestion du matériel our 138.00 CHF par an, frais unique de mise en service 342.00 CHF"
|
||||
// : "Zusatzmodul Materialverwaltung: Jährliche Lizenzkosten 138.00 CHF; Bereitstellung, einmalig 342.00 CHF");
|
||||
// $message .= "<br/>";
|
||||
// }
|
||||
//
|
||||
// $zusatzmodulQrCode = filter_input(INPUT_POST, 'zusatzmodul-qr-code');
|
||||
// if (isset($zusatzmodulQrCode))
|
||||
// {
|
||||
// $message .= ( $lang == "FR" ? "Module supplémentaire code QR pour 36.00 CHF par an, frais unique de mise en service 50.00 CHF"
|
||||
// : "Zusatzmodul QR-Code: Jährliche Lizenzkosten 36.00 CHF; Bereitstellung, einmalig pro Instanz 50.00 CHF");
|
||||
// $message .= "<br/>";
|
||||
// }
|
||||
//
|
||||
// $zusatzmodulPerigon = filter_input(INPUT_POST, 'zusatzmodul-perigon');
|
||||
// if (isset($zusatzmodulPerigon))
|
||||
// {
|
||||
// $message .= "Zusatzmodul Perigon, Bereitstellung, einmalig 50.00 CHF" . "<br/>";
|
||||
// }
|
||||
// Form inputs von Organisation Zusatzmodule
|
||||
$zusatzmodulDienstplan = filter_input(INPUT_POST, 'zusatzmodul-dienstplan');
|
||||
if (isset($zusatzmodulDienstplan))
|
||||
{
|
||||
$message .= "<hr/><p><b>";
|
||||
$message .= "Zusatzmodul Dienstplan</b>: " . "<br/>" . $zusatzmodulDienstplan . "<br/></p>";
|
||||
}
|
||||
|
||||
$zusatzmodulTourenplan = filter_input(INPUT_POST, 'zusatzmodul-tourenplan');
|
||||
if (isset($zusatzmodulTourenplan))
|
||||
{
|
||||
$message .= "<hr/><p><b>";
|
||||
$message .= "Zusatzmodul Tourenplan</b: " . "<br/>" . $zusatzmodulTourenplan . "<br/><br/>";
|
||||
}
|
||||
|
||||
// Form inputs von Zusatzmodule FPP / ORG
|
||||
$zusatzmodulPop2 = filter_input(INPUT_POST, 'zusatzmodul-pop2');
|
||||
if (isset($zusatzmodulPop2))
|
||||
{
|
||||
$message .= "<hr/><p><b>";
|
||||
$message .= "Zusatzmodul POP2</b><br/>Jährliche Lizenzkosten 42.00 CHF; Bereitstellung, einmalig 438.00.00 CHF" . "<br/></p>";
|
||||
}
|
||||
|
||||
$zusatzmodulMaterialverwaltung = filter_input(INPUT_POST, 'zusatzmodul-materialverwaltung');
|
||||
if (isset($zusatzmodulMaterialverwaltung))
|
||||
{
|
||||
$message .= "<hr/><p><b>";
|
||||
$message .= ( $lang == "FR" ? "Module en option pour le matériel"
|
||||
: "Zusatzmodul Materialverwaltung");
|
||||
$message .= "</b><br/>" . $zusatzmodulMaterialverwaltung . "<br/></p>";
|
||||
}
|
||||
|
||||
$zusatzmodulQrCode = filter_input(INPUT_POST, 'zusatzmodul-qr-code');
|
||||
if (isset($zusatzmodulQrCode))
|
||||
{
|
||||
$message .= "<hr/><p><b>";
|
||||
$message .= ( $lang == "FR" ? "Module supplémentaire code QR"
|
||||
: "Optionales Modul QR-Code");
|
||||
$message .= "</b><br/>" . $zusatzmodulQrCode . "<br/></p>";
|
||||
}
|
||||
|
||||
$zusatzmodulPerigon = filter_input(INPUT_POST, 'zusatzmodul-perigon');
|
||||
if (isset($zusatzmodulPerigon))
|
||||
{
|
||||
$message .= "<hr/><p><b>";
|
||||
$message .= "Zusatzmodul Perigon</b><br/>" . $zusatzmodulPerigon . "<br/></p>";
|
||||
}
|
||||
//
|
||||
// // Form inputs von Schulungstermin
|
||||
// $schulungstermin = filter_input(INPUT_POST, 'schulungstermin');
|
||||
|
|
@ -224,7 +230,7 @@ function constructCustomerMessage($bestellMessage, $langForm, $name)
|
|||
$infoCheck = "Voici à nouveau vos informations pour vérification. Si vous trouvez encore une erreur, veuillez nous en informer :" . "<br/><br/>";
|
||||
} else
|
||||
{
|
||||
$message = "Grüezi " . $name . "<br/>";
|
||||
$message = "Grüezi " . $name . "<br/><br/>";
|
||||
$message .= "Vielen Dank für Ihre Bestellung. Wir werden uns so schnell wie möglich bei Ihnen melden." . "<br/><br/>";
|
||||
$messageEnd = "Freundliche Grüsse" . "<br/>";
|
||||
$messageEnd .= "Ihr VeruA Team" . "<br/><hr/>";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue