- Posts: 54
- Thank you received: 1
Ask the community, share ideas, and connect with other LimeSurvey users!
<?php require("../application/third_party/phpmailer/class.phpmailer.php"); $maily = $_POST["mailaddress"]; checkEmail($maily); $nameit =$_POST["Surveyname"]; function checkEmail($adr) { $regEx = '^([^\s@,:"<>]+)@([^\s@,:"<>]+\.[^\s@,:"<>.\d]{2,}|(\d{1,3}\.){3}\d{1,3})$'; $proof = (preg_match("/$regEx/",$adr,$part)) ? $part : false; if ($proof == false) { echo ("Ungültige E-Mail-Adresse"); exit; } } $text = "<p>Es hat jemand das Formular ausgef&uuml;llt.<br>Die Daten lauten:</p>"; $text .= "<br>E-Mail: "; $text .= $maily; $mail = new PHPMailer(); $mail->IsSMTP(); // set mailer to use SMTP $mail->Host = "mailsurver.example.de"; // specify main and backup server $mail->SMTPAuth = false; // turn off SMTP authentication $mail->Username = ""; // SMTP username $mail->Password = ""; // SMTP password $mail->From = "server@example.de"; $mail->FromName = "me"; $mail->AddAddress("admin@example.de"); $betreff = "[Formular] ".$nameit; $mail->AddReplyTo("admin@example.de", "Information"); $mail->Sender="admin@example.de"; $mail->WordWrap = 50; // set word wrap to 50 characters $mail->IsHTML(true); // set email format to HTML $mail->Subject = $betreff; $mail->Body = $text; //$mail->AltBody = "This is the body in plain text for non-HTML mail clients"; //$mail->SMTPDebug = 1; //for debugging if(!$mail->Send()) { echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit; } echo "Mail sent"; ?>