<body> <!-- Begin --> <link rel="stylesheet" href="_alert.css"> <script type="text/javascript" src="_alert.js"></script> <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"> Name:<br /> <input type="text" name="fname"><br /> E-Mail:<br /> <input type="text" name="femail"><br /><br /> <input type="submit" value="Anfordern"> </form> <?php /** * @name : sendMail * @author Taslim Mazumder Sohel * @mailsohel62@yahoo.com * Function for sending email *with Japanese Email Body, Subject, Sender Name. * * @param String $to : Receiver mail address. * @param String $subject : email subject. * @param int $body : mail body text. * @param array $from_email : Sender mail address. * @param array $from_name : Sender Name. * */ function sendMail($Charset, $to, $subject, $body, $from_email,$from_name) { $headers = "MIME-Version: 1.0 \n" ; $headers .= "From: " . "".mb_encode_mimeheader (mb_convert_encoding($from_name,$Charset,"AUTO")) ."" . "<".$from_email."> \n"; $headers .= "Reply-To: " . "".mb_encode_mimeheader (mb_convert_encoding($from_name,$Charset,"AUTO")) ."" . "<".$from_email."> \n"; $headers .= "Content-Type: text/plain;charset=".$Charset." \n"; /* Convert body to same encoding as stated in Content-Type header above */ $body = mb_convert_encoding($body, $Charset,"AUTO"); /* Mail, optional paramiters. */ $sendmail_params = "-f$from_email"; mb_language("ja"); $subject = mb_convert_encoding($subject, $Charset,"AUTO"); $subject = mb_encode_mimeheader($subject); $result = mail($to, $subject, $body, $headers, $sendmail_params); return $result; } if ($_SERVER["REQUEST_METHOD"] == "POST") { // collect value of input field $name = $_REQUEST['fname']; $email = $_REQUEST['femail']; if (empty($name)||empty($email)) { // echo "Name is empty"; <br />Bitte alles Korreckt Eingeben! echo '<script type="text/javascript">' ,'_alert("Info","<br />Bitte alles Korreckt Eingeben!","OK","#CCCCCC","#000000","#3498db","transparent");' ,'</script>' ; } else { // echo $name; $subject = "Subj!"; $nachricht = "Test!!!"; $from_email_from = "admin.admin@mail.ru"; $from_email_to = "andr.breil@gmail.com"; $from_name_admin = "Admin"; sendMail("UTF-8", $email, $subject, $nachricht, $from_email_from, $from_name_admin); sendMail("UTF-8", $from_email_to, $subject, $body, $email, $name); echo '<script type="text/javascript">' ,'_alert("Info","<br />Versendet!","OK","#CCCCCC","#000000","#3498db","transparent");' ,'</script>' ; } } ?> <!-- Ende --> </body> |