File: D:/HostingSpaces/SBogers10/rooymansde.komma-mediadesign.nl/wwwroot/contactformVerzenden.php
<?php
include("all_kms_con.inc.php");
$datum = date("d.m.y");
$tijd = date("H:i:s");
if(isset($_POST['secretcode'])){
$secretcode = $_POST['secretcode'];
if($secretcode == "spamcheckkomma"){
$valid_secretcode = true;
}else{
$valid_secretcode = false;
}
}else{
$valid_secretcode = false;
}
if(isset($_POST['naam'])){
$naam = $_POST['naam'];
}
if(isset($_POST['bedrijfsnaam'])){
$bedrijfsnaam = $_POST['bedrijfsnaam'];
}
if(isset($_POST['geslacht'])){
$geslacht = $_POST['geslacht'];
}
if(isset($_POST['bericht'])){
$bericht = $_POST['bericht'];
}
if(isset($_POST['typeFormulier'])){
$typeFormulier = $_POST['typeFormulier'];
}
if(isset($_POST['vorigePagina'])){
$vorigePagina = $_POST['vorigePagina'];
}
if(isset($_POST['telefoon'])){
$telefoon = $_POST['telefoon'];
$telefoon = trim($telefoon);
$telefoon = str_replace("-","",$telefoon);
$telefoon = str_replace(" ","",$telefoon);
$telefoon = str_replace("+","00",$telefoon);
$valid_telefoon = true;
}else{
$valid_telefoon = false;
}
if(isset($_POST['email']) && !preg_match('/[\w-\.]+@([\w-]+\.)+[\w-]{2,4}/', $_POST['email'])){
$valid_emailadres = false;
$emailadres = $_POST['email'];
}else{
$valid_emailadres = true;
$emailadres = $_POST['email'];
}
if(!empty($naam) && !empty($geslacht) && $valid_emailadres && $valid_secretcode){
$datum = date("Y-m-d");
$tijd = date("H:i:s");
$datum = date_dutch($datum);
require_once 'css-js/phpmailer/class.phpmailer.php';
if($typeFormulier == "contact"){
$onderwerp_invuller = "Contact form Rooymans Neckwear";
$onderwerp_rooymans = "Contactformulier Rooymans Neckwear EN";
$bericht_invuller = "\n
<body style=\"margin: 10px; background-color:#fff;\">
<style>
a{
color:#0063BD;
text-decoration:underline;
}
</style>
<div style=\"color:#6B6663; font-family:Verdana,Geneva,sans-serif; font-size:11px; line-height:18px; padding-bottom:23px; width: 800px;\">
Dear $naam,<br><br>
We have received your data successfully.<br>
One of our account managers will contact you as soon as possible.<br><br>
Your question or remark:<br>
$bericht
<br><br><br>
Best regards,<br>
Rooymans Neckwear<br><br>
Tel: +31 (0)495-592842<br>
Fax: +31 (0)495-593635<br>
Email: info@rooymans-ties.co.uk<br><br>
<strong>Visiting address</strong><br>
't Inne 5<br>
6021 DA Budel (NL)<br><br>
<strong>Address</strong><br>
P.O. Box 2204<br>
6020 AE Budel (NL)<br><br>
<br><br>
</div>
</body>";
$bericht_rooymans = "\n
<body style=\"margin: 10px; background-color:#fff;\">
<style>
a{
color:#0063BD;
text-decoration:underline;
}
</style>
<div style=\"color:#6B6663; font-family:Verdana,Geneva,sans-serif; font-size:11px; line-height:18px; padding-bottom:23px; width: 800px;\">
Bij deze de gegevens van een persoon die het contactformulier op de Rooymans Neckwear.co.uk website heeft ingevuld.<br>
Ingevuld op $datum om $tijd<br><br>
<strong>Contactgegevens: </strong><br>
Naam: $naam<br>
Geslacht: $geslacht<br>
Bedrijfsnaam: $bedrijfsnaam<br>
Telefoonnummer: $telefoon<br>
E-mailadres: $emailadres<br>
Bericht: $bericht<br><br>
<br><br>
</div>
</body>";
}else{
$onderwerp_invuller = "Quotation request Rooymans Neckwear";
$onderwerp_rooymans = "Offerte aanvraag Rooymans Neckwear EN";
$bericht_invuller = "\n
<body style=\"margin: 10px; background-color:#fff;\">
<style>
a{
color:#0063BD;
text-decoration:underline;
}
</style>
<div style=\"color:#6B6663; font-family:Verdana,Geneva,sans-serif; font-size:11px; line-height:18px; padding-bottom:23px; width: 800px;\">
Dear $naam,<br><br>
We have received your request for a quotation successfully.<br>
One of our account managers will contact you as soon as possible.<br><br>
Your question or remark:<br>
$bericht
<br><br><br>
If you would like to send us your logo, you can send this to info@rooymans-ties.co.uk or through a reply to this e-mail.<br>
Delivery specifications:<br>
- .eps<br>
- .ai<br>
- .pdf<br><br>
Best regards,<br>
Rooymans Neckwear<br><br>
Tel: +31 (0)495-592842<br>
Fax: +31 (0)495-593635<br>
Email: info@rooymans-ties.co.uk<br><br>
<strong>Visiting address</strong><br>
't Inne 5<br>
6021 DA Budel (NL)<br><br>
<strong>Address</strong><br>
P.O. Box 2204<br>
6020 AE Budel (NL)<br><br>
<br><br>
</div>
</body>";
$bericht_rooymans = "\n
<body style=\"margin: 10px; background-color:#fff;\">
<style>
a{
color:#0063BD;
text-decoration:underline;
}
</style>
<div style=\"color:#6B6663; font-family:Verdana,Geneva,sans-serif; font-size:11px; line-height:18px; padding-bottom:23px; width: 800px;\">
Bij deze de gegevens van een persoon die het offerte aanvraagformulier op de Rooymans Neckwear website heeft ingevuld.<br>
Ingevuld op $datum om $tijd<br><br>
<strong>Contactgegevens: </strong><br>
Naam: $naam<br>
Geslacht: $geslacht<br>
Bedrijfsnaam: $bedrijfsnaam<br>
Telefoonnummer: $telefoon<br>
E-mailadres: $emailadres<br>
Bericht: $bericht<br><br>
Laatste pagina voor bezoek offerte pagina: $vorigePagina<br><br>
<br><br>
</div>
</body>";
}
$send_message_invuller = false;
$send_message_rooymans = false;
$from = "info@rooymans-ties.co.uk";
$from_naam = "Rooymans Neckwear";
$mail_rooymans = new PHPMailer(true); //defaults to using php "mail()"; the true param means it will throw exceptions on errors, which we need to catch
try {
$mail_rooymans->AddAddress($from, $from_naam);
$mail_rooymans->SetFrom($from, $from_naam);
$mail_rooymans->AddReplyTo($from, $from_naam);
$mail_rooymans->Subject = $onderwerp_rooymans;
$mail_rooymans->MsgHTML($bericht_rooymans);
$mail_rooymans->Send();
$send_message_rooymans = true;
} catch (phpmailerException $e) {
$send_message_rooymans = false;
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
$send_message_rooymans = false;
echo $e->getMessage(); //Boring error messages from anything else!
}
$mail_invuller = new PHPMailer(true); //defaults to using php "mail()"; the true param means it will throw exceptions on errors, which we need to catch
try {
$mail_invuller->AddAddress($emailadres, $naam);
$mail_invuller->SetFrom($from, $from_naam);
$mail_invuller->AddReplyTo($from, $from_naam);
$mail_invuller->Subject = $onderwerp_invuller;
$mail_invuller->MsgHTML($bericht_invuller);
$mail_invuller->Send();
$send_message_invuller = true;
} catch (phpmailerException $e) {
$send_message_invuller = false;
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
$send_message_invuller = false;
echo $e->getMessage(); //Boring error messages from anything else!
}
}?>