use phpmailer #4
Dieser Commit ist enthalten in:
Ursprung
467f88e570
Commit
19fbca2693
2 geänderte Dateien mit 305 neuen und 286 gelöschten Zeilen
2
.gitignore
gevendort
2
.gitignore
gevendort
|
@ -8,3 +8,5 @@ dist/
|
|||
nbdist/
|
||||
.nb-gradle/
|
||||
|
||||
/php/cl_contactform_output_Dodger.php
|
||||
/php/cl_contactform_input_Dodger.php
|
||||
|
|
|
@ -39,18 +39,19 @@
|
|||
private function sendEmail() {
|
||||
$this->unravel($this->suppress('sent'));
|
||||
$this->generateEmailMessage();
|
||||
mail(
|
||||
$this->email['adresses'],
|
||||
$this->email['subject'],
|
||||
$this->email['message'],
|
||||
sprintf(
|
||||
"From: %s <%s>\nReply-To: %s\nX-Mailer: PHP/%s",
|
||||
$this->email['from']['name'],
|
||||
$this->email['from']['email'],
|
||||
$this->email['from']['email'],
|
||||
phpversion()
|
||||
)
|
||||
);
|
||||
|
||||
$oMailer = new PHPMailer();
|
||||
$oMailer->AddAddress($this->email['adresses']);
|
||||
$oMailer->From = $this->email['from']['email'];
|
||||
$oMailer->FromName = $this->email['from']['name'];
|
||||
$oMailer->Subject = $this->email['subject'];
|
||||
$oMailer->Body = $this->email['message'];
|
||||
|
||||
if($oMailer->send()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private function unravel($toUnravel, $prefix = '') {
|
||||
|
@ -270,20 +271,38 @@
|
|||
}
|
||||
|
||||
private function success() {
|
||||
$this->sendEmail();
|
||||
if($this->sendEmail()) {
|
||||
echo $this->form['answer'];
|
||||
} else {
|
||||
echo '<span style="color:red;">'.mi18n("Es ist ein Fehler aufgetreten!<br>Bitte versuchen Sie es später noch einmal.").'</span>';
|
||||
}
|
||||
}
|
||||
|
||||
private function formFieldCorrect(&$field) {
|
||||
// prüfung, ob pflichtfeld vorhanden
|
||||
if (!empty($field['mandatory']) && $field['mandatory'] == 'true' && empty($_POST["{$field['name']}"]))
|
||||
|
||||
$tmp_name = rtrim($field['name'], '[0]');
|
||||
preg_match('/\[(\d*)\]/', $field['name'], $matches);
|
||||
$bEmptyPost = false;
|
||||
if (is_array($_POST[$tmp_name])) {
|
||||
if (empty($_POST[$tmp_name][$matches[1]])) {
|
||||
$bEmptyPost = true;
|
||||
}
|
||||
} elseif (empty($_POST[$tmp_name])) {
|
||||
$bEmptyPost = true;
|
||||
}
|
||||
|
||||
if (!empty($field['mandatory']) && $field['mandatory'] == 'true' && $bEmptyPost) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// wenn das formularfeld kein pflichtfeld und nicht vorhanden ist, true zurück geben
|
||||
if (empty($_POST["{$field['name']}"]))
|
||||
if ($bEmptyPost) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// regular expression prüfungen
|
||||
if (!empty($feld['valid']) && $feld['valid'] == 'textmitumbruch' && !preg_match("/^[ \n\r.,;!?()öäüéàèâêîça-z0-9-]*$", $_POST["{$field['name']}"]))
|
||||
return false;
|
||||
if (!empty($field['valid']) && $field['valid'] == 'simpletext' && !preg_match("/^[öäüéàèâêîça-z-]*$/i", $_POST["{$field['name']}"]))
|
||||
return false;
|
||||
if (!empty($field['valid']) && $field['valid'] == 'text' && !preg_match("/^[ .,;!?()öäüéàèâêîça-z-]*$/i", $_POST["{$field['name']}"]))
|
||||
|
@ -296,7 +315,6 @@
|
|||
return false;
|
||||
if (!empty($field['valid']) && $field['valid'] == 'email' && !preg_match("/^[öäüéàèâêîç_a-z0-9-]+(\.[öäüéàèâêîç_a-z0-9-]+)*@[öäüéàèâêîça-z0-9-]+(\.[öäüéàèâêîça-z0-9-]+)*$/i", $_POST["{$field['name']}"]))
|
||||
return false;
|
||||
|
||||
// grössenbereich bei integer und float prüfen
|
||||
if (!empty($field['minvalue']) && $_POST["{$field['name']}"] < $field['minvalue'])
|
||||
return false;
|
||||
|
@ -340,5 +358,4 @@
|
|||
$form->setAnswer("CMS_HTML[1]");
|
||||
$form->process();
|
||||
}
|
||||
|
||||
?>
|
Laden …
Tabelle hinzufügen
In neuem Issue referenzieren