PSD-Tutorials.de
Forum für Design, Fotografie & Bildbearbeitung
Tutkit
Agentur
Hilfe
Kontakt
Start
Forum
Aktuelles
Besonderer Inhalt
Foren durchsuchen
Tutorials
News
Anmelden
Kostenlos registrieren
Aktuelles
Suche
Suche
Nur Titel durchsuchen
Von:
Menü
Anmelden
Kostenlos registrieren
App installieren
Installieren
JavaScript ist deaktiviert. Für eine bessere Darstellung aktiviere bitte JavaScript in deinem Browser, bevor du fortfährst.
Du verwendest einen veralteten Browser. Es ist möglich, dass diese oder andere Websites nicht korrekt angezeigt werden.
Du solltest ein Upgrade durchführen oder einen
alternativen Browser
verwenden.
Antworten auf deine Fragen:
Neues Thema erstellen
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
PHP, Javascript, jQuery, Ajax, nodeJS, MySQL...
Hilfe beim PHP Kontaktformular
Beitrag
<blockquote data-quote="Gimpi" data-source="post: 2094571" data-attributes="member: 498731"><p>Hallo</p><p></p><p>Ich versuche eine Website mit Hilfe von einem Template(Themeforest) zu realisieren und dies gelingt mir ganz gut bis auf das PHP Kontaktformular.</p><p></p><p>Ich habe von PHP keine Ahnung und möchte mich zwar damit beschäftigen aber diese Seite wird darauf nicht warten können.</p><p></p><p>Wäre sehr dankbar wenn mir Jemand sagen könnte wohin ich die Email-adresse eingeben soll und was ich sonst noch ergänzen sollte. </p><p>Vielen vielen Dank im Voraus. <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /> :blumen:</p><p></p><p>Hier das HTML:</p><p></p><p>[HTML]<!--Success notifications-info text--></p><p> <div class="notifications clearfix" style="display:none"></p><p> <div class="alert alert-info"></p><p> <a class="close" data-dismiss="alert" href="#">×</a></p><p> <strong>Success</strong> Send Messages Complete !</p><p> </div></p><p> </div></p><p></p><p> <form class="form-horizontal" id="contactform"></p><p> <div class="control-group"></p><p> <label class="control-label" >Name</label></p><p> <div class="controls"></p><p> <input type="text" name="youname" id="youname" class="validate[required] span3" /></p><p> </div></p><p> </div></p><p> <div class="control-group"></p><p> <label class="control-label" >Email</label></p><p> <div class="controls"></p><p> <input type="text" name="email" id="email" class="validate[required,custom[email]] span3"/></p><p> </div></p><p> </div></p><p> <div class="control-group"></p><p> <label class="control-label" for="textarea">Nachricht</label></p><p> <div class="controls"></p><p> <textarea name="Messages" class="validate[required] input-xlarge " id="textarea" rows="3"></textarea></p><p> </div></p><p> </div></p><p> <div class="control-group last"></p><p> <div class="controls"></p><p> <button type="submit" class="btn">NACHRICHT SENDEN</button></p><p> </div></p><p> </div></p><p> </form>[/HTML]</p><p></p><p>Hier die eine PHP Datei:</p><p></p><p>[PHP]<?php</p><p>header("Cache-Control: no-store, no-cache, must-revalidate");</p><p>header("Cache-Control: post-check=0, pre-check=0", false);</p><p>header('Content-type:text/html;charset=utf8');</p><p> include("js/sendmail/mimemail.inc.php");</p><p></p><p>sleep(2);</p><p></p><p>$name = $_REQUEST['youname'];</p><p>$email = $_REQUEST['email'];</p><p>$message =stripslashes($_REQUEST['Messages']); // messages</p><p>$subject = "Test Email By owua GmbH";</p><p></p><p>if($name and $email ){</p><p></p><p> $mail = new MIMEMAIL("HTML");</p><p> $mail->senderName = "$name";</p><p> $mail->senderMail = "$email";</p><p> $mail->subject = "$subject";</p><p> $mail->body = $message;</p><p> $mail->attachment[] = ""; // if you have attach file used part example "images/01.jpg"</p><p> $mail->create();</p><p> $mail->send("$email");</p><p></p><p> $check="1"; // if complete set check = 1</p><p></p><p>}else{ // not complete</p><p></p><p> $check="0"; // set check = 0</p><p></p><p>}</p><p></p><p>$return_arr["check"] = $check; // set data respone</p><p>echo json_encode($return_arr); // encode json data respone</p><p></p><p>?>[/PHP]</p><p></p><p>und Hier die andere:</p><p></p><p>[PHP]<?</p><p>/*</p><p> +-------------------------------------------------------------------+</p><p> | M I M E M A I L (v1.5) |</p><p> | |</p><p> | Copyright Gerd Tentler www.gerd-tentler.de/tools |</p><p> | Created: Nov. 2, 2004 Last modified: Oct. 19, 2005 |</p><p> +-------------------------------------------------------------------+</p><p> | This program may be used and hosted free of charge by anyone for |</p><p> | personal purpose as long as this copyright notice remains intact. |</p><p> | |</p><p> | Obtain permission before selling the code for this program or |</p><p> | hosting this software on a commercial website or redistributing |</p><p> | this software over the Internet or in any other medium. In all |</p><p> | cases copyright must remain intact. |</p><p> +-------------------------------------------------------------------+</p><p></p><p>==========================================================================================================</p><p> This script can send MIME-mails with attachments. It uses the PHP mail-function.</p><p></p><p> EXAMPLE:</p><p></p><p> $mail = new MIMEMAIL("HTML");</p><p></p><p> $mail->senderName = "sender name";</p><p> $mail->senderMail = "sender@email";</p><p> $mail->bcc = "bcc@email";</p><p></p><p> $mail->subject = "This is the subject line";</p><p></p><p> $mail->body = "Hello! This is a message for you."; // OR: $mail->body = "path_to_file/filename";</p><p></p><p> $mail->attachment[] = "path_to_file1/filename1";</p><p> $mail->attachment[] = "path_to_file2/filename2";</p><p> ...</p><p></p><p> $mail->create();</p><p></p><p> $mail->send("recipient1@email");</p><p> $mail->send("recipient2@email,recipient3@email,recipient4@email");</p><p> ...</p><p>==========================================================================================================</p><p>*/</p><p> error_reporting(E_WARNING);</p><p></p><p> class MIMEMAIL {</p><p>//--------------------------------------------------------------------------------------------------------</p><p>// Configuration</p><p>//--------------------------------------------------------------------------------------------------------</p><p> var $type = 'Text'; // e-mail type ("HTML" or "Text")</p><p> var $senderName = ''; // sender name</p><p> var $senderMail = ''; // sender e-mail address</p><p> var $cc = ''; // Cc (e-mail address)</p><p> var $bcc = ''; // Bcc (e-mail address)</p><p> var $documentRoot = ''; // document root (path to images, stylesheets, etc.)</p><p> var $saveDir = ''; // save e-mail to this directory (do not send) => just for testing :)</p><p>// var $charSet = 'ISO-8859-1'; // character set (ISO)</p><p> var $charSet = 'windows-874';</p><p> var $useQueue = false; // use mail queue (true = yes, false = no) => does not work with PHP</p><p> // versions < 4.0.5, or with versions >= 4.2.3 in Safe Mode, or with</p><p> // MTAs other than sendmail!</p><p></p><p> var $mime = array('jpg' => 'image/jpeg',</p><p> 'jpeg' => 'image/jpeg',</p><p> 'gif' => 'image/gif',</p><p> 'png' => 'image/png',</p><p> 'swf' => 'application/x-shockwave-flash',</p><p> 'doc' => 'application/msword',</p><p> 'xls' => 'application/msexcel',</p><p> 'ppt' => 'application/mspowerpoint',</p><p> 'pdf' => 'application/pdf',</p><p> 'zip' => 'application/zip',</p><p> 'rtf' => 'text/rtf',</p><p> 'rtx' => 'text/richtext',</p><p> 'txt' => 'text/plain',</p><p> 'js' => 'text/javascript',</p><p> 'css' => 'text/css');</p><p></p><p> var $exclude = array('htm', 'php', 'pl', 'prl', 'cgi');</p><p> var $inline = array();</p><p> var $attachment = array();</p><p> var $subject, $body, $header, $footer;</p><p></p><p>//--------------------------------------------------------------------------------------------------------</p><p>// Functions</p><p>//--------------------------------------------------------------------------------------------------------</p><p> function MIMEMAIL($type = '') {</p><p> if($type) $this->type = $type;</p><p> }</p><p></p><p> function get_img_type($data) {</p><p> $abc = substr($data, 0, 20);</p><p> if(strstr($abc, 'GIF')) $ftype = 'gif';</p><p> else if(strstr($abc, 'JFIF') || strstr($abc, 'Exif')) $ftype = 'jpeg';</p><p> else if(strstr($abc, 'PNG')) $ftype = 'png';</p><p> else if(strstr($abc, 'FWS') || strstr($abc, 'CWS')) $ftype = 'swf';</p><p> else $ftype = '';</p><p></p><p> return $ftype;</p><p> }</p><p></p><p> function get_img_data($html, $m, $css) {</p><p> global $HTTP_HOST;</p><p></p><p> $host = 'http://' . ereg_replace('/$', '', $HTTP_HOST);</p><p></p><p> for($i = 0; $i < count($m[0]); $i++) {</p><p> $ftype = $data = $ext = $fname = '';</p><p></p><p> if(!preg_match('/^(http|ftp|mailto|javascript)/i', $m[2][$i])) {</p><p> $inlName = $m[2][$i];</p><p> $ext = substr($inlName, strrpos($inlName, '.') + 1);</p><p> $incl = true;</p><p></p><p> for($j = 0; $j < count($this->exclude) && $incl; $j++) {</p><p> if(stristr($ext, $this->exclude[$j])) $incl = false;</p><p> }</p><p></p><p> if($incl) {</p><p> if($this->documentRoot) {</p><p> $doc_root = $this->documentRoot;</p><p></p><p> while(ereg('^\.\./', $inlName)) {</p><p> $inlName = substr($inlName, 3);</p><p> $doc_root = ereg_replace('/[^/]+$', '', $doc_root);</p><p> }</p><p> $fname = "$doc_root/$inlName";</p><p> }</p><p> else $fname = $inlName;</p><p></p><p> if($fp = @fopen($fname, 'rb')) {</p><p> $data = fread($fp, @filesize($fname));</p><p> fclose($fp);</p><p> }</p><p> }</p><p> }</p><p></p><p> if($data) {</p><p> if(!$ext) $ftype = $this->get_img_type($data);</p><p> else $ftype = $ext;</p><p></p><p> if($css) $html = str_replace($m[0][$i], ' ' . $m[1][$i] . '(cid:' . $inlName . ')', $html);</p><p> else $html = str_replace($m[0][$i], ' ' . $m[1][$i] . '="cid:' . $inlName . '"', $html);</p><p></p><p> if(!$this->inline[$ftype][$inlName]) {</p><p> $this->inline[$ftype][$inlName] = chunk_split(base64_encode($data));</p><p> }</p><p> }</p><p> else if(!preg_match('/^(http|ftp|mailto|javascript)/i', $m[2][$i])) {</p><p> if($css) $html = str_replace($m[0][$i], ' ' . $m[1][$i] . "($host/$inlName)", $html);</p><p> else $html = str_replace($m[0][$i], ' ' . $m[1][$i] . "=\"$host/$inlName\"", $html);</p><p> }</p><p> }</p><p> return $html;</p><p> }</p><p></p><p> function check_body() {</p><p> if(preg_match_all('/ (src|background|href)="?([^" >]+)"?/i', $this->body, $m))</p><p> $this->body = $this->get_img_data($this->body, $m, false);</p><p> if(preg_match_all('/ (url)\(([^\)]+)\)/i', $this->body, $m))</p><p> $this->body = $this->get_img_data($this->body, $m, true);</p><p></p><p> $this->body = preg_replace("/<(table|tr|div)([^>]*)>\r?\n?/i", "<\\1\\2>\r\n", $this->body);</p><p> $this->body = preg_replace("/<\/(table|tr|td|style|script|div|p)>\r?\n?/i", "</\\1>\r\n", $this->body);</p><p> }</p><p></p><p> function prepare() {</p><p> $attachments = $filetype = array();</p><p></p><p> if(count($this->attachment)) while(list(, $att) = each($this->attachment)) {</p><p> if($att && $att != 'none') {</p><p> if($fp = @fopen($att, 'rb')) {</p><p> $filename = basename(str_replace('\\', '/', $att));</p><p> $file = fread($fp, @filesize($att));</p><p> fclose($fp);</p><p></p><p> $ext = substr($filename, strrpos($filename, '.')+1);</p><p> $filetype[$filename] = $this->mime[$ext] ? $this->mime[$ext] : 'application/octet-stream';</p><p> $attachments[$filename] = chunk_split(base64_encode($file));</p><p> }</p><p> }</p><p> }</p><p></p><p> $this->header = $this->footer = '';</p><p> $uid1 = 'Next_' . strtoupper(md5(uniqid(time()) . 1));</p><p> $uid2 = 'Next_' . strtoupper(md5(uniqid(time()) . 2));</p><p></p><p> $this->header .= "Return-Path: " . $this->senderMail . "\n" .</p><p> "Subject:\n" .</p><p> "From: " . $this->senderName . " <" . $this->senderMail . ">\n" .</p><p> "X-Sender: <" . $this->senderMail . ">\n" .</p><p> "X-Mailer: PHP " . phpversion() . "\n" .</p><p> "MIME-Version: 1.0\n";</p><p></p><p> if($this->cc) $this->header .= "Cc: " . $this->cc . "\n";</p><p> if($this->bcc) $this->header .= "Bcc: " . $this->bcc . "\n";</p><p></p><p> if($this->type == 'HTML' || count($attachments)) {</p><p> $this->header .= "Content-Type: multipart/mixed;\n\t" .</p><p> "boundary=\"$uid1\"\n\n" .</p><p> "This is a multi-part message in MIME format.\n\n" .</p><p> "--$uid1\n";</p><p> }</p><p></p><p> if($this->type == 'HTML') {</p><p> $this->header .= "Content-Type: multipart/related;\n\t" .</p><p> "boundary=\"$uid2\"\n\n" .</p><p> "--$uid2\n";</p><p> }</p><p></p><p> $this->header .= "Content-Type: text/" . (($this->type == 'HTML') ? 'html' : 'plain') . ";\n\t" .</p><p> "charset=\"" . $this->charSet . "\"\n" .</p><p> "Content-Transfer-Encoding: 8bit\n\n";</p><p></p><p> if($this->type == 'HTML') {</p><p> if(count($this->inline)) while(list($ftype, $arr) = each($this->inline)) {</p><p> if(count($arr)) while(list($inlName, $data) = each($arr)) {</p><p> $inlType = $this->mime[$ftype] ? $this->mime[$ftype] : 'application/octet-stream';</p><p> $this->footer .= "--$uid2\n" .</p><p> "Content-Type: $inlType;\n\t" .</p><p> "name=\"$inlName\"\n" .</p><p> "Content-ID: <$inlName>\n" .</p><p> "Content-Disposition: inline;\n\t" .</p><p> "filename=\"$inlName\"\n" .</p><p> "Content-Transfer-Encoding: base64\n\n" .</p><p> "$data\n\n";</p><p> }</p><p> }</p><p> $this->footer .= "--$uid2--\n\n";</p><p> }</p><p></p><p> if(count($attachments)) while(list($filename, $file) = each($attachments)) {</p><p> $this->footer .= "--$uid1\n" .</p><p> 'Content-Type: ' . $filetype[$filename] . ";\n\t" .</p><p> "name=\"$filename\"\n" .</p><p> "Content-Disposition: attachment;\n\t" .</p><p> "filename=\"$filename\"\n" .</p><p> "Content-Transfer-Encoding: base64\n\n" .</p><p> "$file\n\n";</p><p> }</p><p></p><p> if($this->type == 'HTML' || $file) $this->footer .= "--$uid1--";</p><p> }</p><p></p><p> function send($email) {</p><p> if($this->saveDir) $this->header = str_replace("Subject:\n", 'Subject: ' . $this->subject . "\n", $this->header);</p><p> else $this->header = str_replace("Subject:\n", '', $this->header);</p><p></p><p> $mime_mail = $this->header . $this->body . "\n\n" . $this->footer;</p><p></p><p> if($this->saveDir) {</p><p> if($fp = @fopen($this->saveDir . '/mail.eml', 'w')) {</p><p> $mime_mail = "To: $email\n" . $mime_mail;</p><p> fwrite($fp, $mime_mail, strlen($mime_mail));</p><p> fclose($fp);</p><p> $ok = true;</p><p> }</p><p> else $ok = false;</p><p> }</p><p> else {</p><p> $php_ver = phpversion();</p><p> if(function_exists('ini_get')) $safe_mode = ini_get('safe_mode');</p><p> else $safe_mode = get_cfg_var('safe_mode');</p><p></p><p> if($php_ver < '4.0.5' || ($php_ver >= '4.2.3' && $safe_mode)) {</p><p> $ok = @mail($email, $this->subject, '', $mime_mail);</p><p> }</p><p> else {</p><p> $options = ($this->useQueue ? '-odq ' : '') . '-i -f ' . $this->senderMail;</p><p> $ok = @mail($email, $this->subject, '', $mime_mail, $options);</p><p> }</p><p> }</p><p></p><p> return $ok;</p><p> }</p><p></p><p> function create() {</p><p> if(strlen($this->body) < 100) {</p><p> $file = str_replace('\\', '/', $this->body);</p><p></p><p> if($fp = @fopen($file, 'r')) {</p><p> $this->body = fread($fp, @filesize($file));</p><p> fclose($fp);</p><p> $this->documentRoot= dirname($file);</p><p> }</p><p> }</p><p> if($this->type == 'HTML') $this->check_body();</p><p> $this->prepare();</p><p> }</p><p> }</p><p>?></p><p>[/PHP]</p></blockquote><p></p>
[QUOTE="Gimpi, post: 2094571, member: 498731"] Hallo Ich versuche eine Website mit Hilfe von einem Template(Themeforest) zu realisieren und dies gelingt mir ganz gut bis auf das PHP Kontaktformular. Ich habe von PHP keine Ahnung und möchte mich zwar damit beschäftigen aber diese Seite wird darauf nicht warten können. Wäre sehr dankbar wenn mir Jemand sagen könnte wohin ich die Email-adresse eingeben soll und was ich sonst noch ergänzen sollte. Vielen vielen Dank im Voraus. :) :blumen: Hier das HTML: [HTML]<!--Success notifications-info text--> <div class="notifications clearfix" style="display:none"> <div class="alert alert-info"> <a class="close" data-dismiss="alert" href="#">×</a> <strong>Success</strong> Send Messages Complete ! </div> </div> <form class="form-horizontal" id="contactform"> <div class="control-group"> <label class="control-label" >Name</label> <div class="controls"> <input type="text" name="youname" id="youname" class="validate[required] span3" /> </div> </div> <div class="control-group"> <label class="control-label" >Email</label> <div class="controls"> <input type="text" name="email" id="email" class="validate[required,custom[email]] span3"/> </div> </div> <div class="control-group"> <label class="control-label" for="textarea">Nachricht</label> <div class="controls"> <textarea name="Messages" class="validate[required] input-xlarge " id="textarea" rows="3"></textarea> </div> </div> <div class="control-group last"> <div class="controls"> <button type="submit" class="btn">NACHRICHT SENDEN</button> </div> </div> </form>[/HTML] Hier die eine PHP Datei: [PHP]<?php header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header('Content-type:text/html;charset=utf8'); include("js/sendmail/mimemail.inc.php"); sleep(2); $name = $_REQUEST['youname']; $email = $_REQUEST['email']; $message =stripslashes($_REQUEST['Messages']); // messages $subject = "Test Email By owua GmbH"; if($name and $email ){ $mail = new MIMEMAIL("HTML"); $mail->senderName = "$name"; $mail->senderMail = "$email"; $mail->subject = "$subject"; $mail->body = $message; $mail->attachment[] = ""; // if you have attach file used part example "images/01.jpg" $mail->create(); $mail->send("$email"); $check="1"; // if complete set check = 1 }else{ // not complete $check="0"; // set check = 0 } $return_arr["check"] = $check; // set data respone echo json_encode($return_arr); // encode json data respone ?>[/PHP] und Hier die andere: [PHP]<? /* +-------------------------------------------------------------------+ | M I M E M A I L (v1.5) | | | | Copyright Gerd Tentler www.gerd-tentler.de/tools | | Created: Nov. 2, 2004 Last modified: Oct. 19, 2005 | +-------------------------------------------------------------------+ | This program may be used and hosted free of charge by anyone for | | personal purpose as long as this copyright notice remains intact. | | | | Obtain permission before selling the code for this program or | | hosting this software on a commercial website or redistributing | | this software over the Internet or in any other medium. In all | | cases copyright must remain intact. | +-------------------------------------------------------------------+ ========================================================================================================== This script can send MIME-mails with attachments. It uses the PHP mail-function. EXAMPLE: $mail = new MIMEMAIL("HTML"); $mail->senderName = "sender name"; $mail->senderMail = "sender@email"; $mail->bcc = "bcc@email"; $mail->subject = "This is the subject line"; $mail->body = "Hello! This is a message for you."; // OR: $mail->body = "path_to_file/filename"; $mail->attachment[] = "path_to_file1/filename1"; $mail->attachment[] = "path_to_file2/filename2"; ... $mail->create(); $mail->send("recipient1@email"); $mail->send("recipient2@email,recipient3@email,recipient4@email"); ... ========================================================================================================== */ error_reporting(E_WARNING); class MIMEMAIL { //-------------------------------------------------------------------------------------------------------- // Configuration //-------------------------------------------------------------------------------------------------------- var $type = 'Text'; // e-mail type ("HTML" or "Text") var $senderName = ''; // sender name var $senderMail = ''; // sender e-mail address var $cc = ''; // Cc (e-mail address) var $bcc = ''; // Bcc (e-mail address) var $documentRoot = ''; // document root (path to images, stylesheets, etc.) var $saveDir = ''; // save e-mail to this directory (do not send) => just for testing :) // var $charSet = 'ISO-8859-1'; // character set (ISO) var $charSet = 'windows-874'; var $useQueue = false; // use mail queue (true = yes, false = no) => does not work with PHP // versions < 4.0.5, or with versions >= 4.2.3 in Safe Mode, or with // MTAs other than sendmail! var $mime = array('jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png', 'swf' => 'application/x-shockwave-flash', 'doc' => 'application/msword', 'xls' => 'application/msexcel', 'ppt' => 'application/mspowerpoint', 'pdf' => 'application/pdf', 'zip' => 'application/zip', 'rtf' => 'text/rtf', 'rtx' => 'text/richtext', 'txt' => 'text/plain', 'js' => 'text/javascript', 'css' => 'text/css'); var $exclude = array('htm', 'php', 'pl', 'prl', 'cgi'); var $inline = array(); var $attachment = array(); var $subject, $body, $header, $footer; //-------------------------------------------------------------------------------------------------------- // Functions //-------------------------------------------------------------------------------------------------------- function MIMEMAIL($type = '') { if($type) $this->type = $type; } function get_img_type($data) { $abc = substr($data, 0, 20); if(strstr($abc, 'GIF')) $ftype = 'gif'; else if(strstr($abc, 'JFIF') || strstr($abc, 'Exif')) $ftype = 'jpeg'; else if(strstr($abc, 'PNG')) $ftype = 'png'; else if(strstr($abc, 'FWS') || strstr($abc, 'CWS')) $ftype = 'swf'; else $ftype = ''; return $ftype; } function get_img_data($html, $m, $css) { global $HTTP_HOST; $host = 'http://' . ereg_replace('/$', '', $HTTP_HOST); for($i = 0; $i < count($m[0]); $i++) { $ftype = $data = $ext = $fname = ''; if(!preg_match('/^(http|ftp|mailto|javascript)/i', $m[2][$i])) { $inlName = $m[2][$i]; $ext = substr($inlName, strrpos($inlName, '.') + 1); $incl = true; for($j = 0; $j < count($this->exclude) && $incl; $j++) { if(stristr($ext, $this->exclude[$j])) $incl = false; } if($incl) { if($this->documentRoot) { $doc_root = $this->documentRoot; while(ereg('^\.\./', $inlName)) { $inlName = substr($inlName, 3); $doc_root = ereg_replace('/[^/]+$', '', $doc_root); } $fname = "$doc_root/$inlName"; } else $fname = $inlName; if($fp = @fopen($fname, 'rb')) { $data = fread($fp, @filesize($fname)); fclose($fp); } } } if($data) { if(!$ext) $ftype = $this->get_img_type($data); else $ftype = $ext; if($css) $html = str_replace($m[0][$i], ' ' . $m[1][$i] . '(cid:' . $inlName . ')', $html); else $html = str_replace($m[0][$i], ' ' . $m[1][$i] . '="cid:' . $inlName . '"', $html); if(!$this->inline[$ftype][$inlName]) { $this->inline[$ftype][$inlName] = chunk_split(base64_encode($data)); } } else if(!preg_match('/^(http|ftp|mailto|javascript)/i', $m[2][$i])) { if($css) $html = str_replace($m[0][$i], ' ' . $m[1][$i] . "($host/$inlName)", $html); else $html = str_replace($m[0][$i], ' ' . $m[1][$i] . "=\"$host/$inlName\"", $html); } } return $html; } function check_body() { if(preg_match_all('/ (src|background|href)="?([^" >]+)"?/i', $this->body, $m)) $this->body = $this->get_img_data($this->body, $m, false); if(preg_match_all('/ (url)\(([^\)]+)\)/i', $this->body, $m)) $this->body = $this->get_img_data($this->body, $m, true); $this->body = preg_replace("/<(table|tr|div)([^>]*)>\r?\n?/i", "<\\1\\2>\r\n", $this->body); $this->body = preg_replace("/<\/(table|tr|td|style|script|div|p)>\r?\n?/i", "</\\1>\r\n", $this->body); } function prepare() { $attachments = $filetype = array(); if(count($this->attachment)) while(list(, $att) = each($this->attachment)) { if($att && $att != 'none') { if($fp = @fopen($att, 'rb')) { $filename = basename(str_replace('\\', '/', $att)); $file = fread($fp, @filesize($att)); fclose($fp); $ext = substr($filename, strrpos($filename, '.')+1); $filetype[$filename] = $this->mime[$ext] ? $this->mime[$ext] : 'application/octet-stream'; $attachments[$filename] = chunk_split(base64_encode($file)); } } } $this->header = $this->footer = ''; $uid1 = 'Next_' . strtoupper(md5(uniqid(time()) . 1)); $uid2 = 'Next_' . strtoupper(md5(uniqid(time()) . 2)); $this->header .= "Return-Path: " . $this->senderMail . "\n" . "Subject:\n" . "From: " . $this->senderName . " <" . $this->senderMail . ">\n" . "X-Sender: <" . $this->senderMail . ">\n" . "X-Mailer: PHP " . phpversion() . "\n" . "MIME-Version: 1.0\n"; if($this->cc) $this->header .= "Cc: " . $this->cc . "\n"; if($this->bcc) $this->header .= "Bcc: " . $this->bcc . "\n"; if($this->type == 'HTML' || count($attachments)) { $this->header .= "Content-Type: multipart/mixed;\n\t" . "boundary=\"$uid1\"\n\n" . "This is a multi-part message in MIME format.\n\n" . "--$uid1\n"; } if($this->type == 'HTML') { $this->header .= "Content-Type: multipart/related;\n\t" . "boundary=\"$uid2\"\n\n" . "--$uid2\n"; } $this->header .= "Content-Type: text/" . (($this->type == 'HTML') ? 'html' : 'plain') . ";\n\t" . "charset=\"" . $this->charSet . "\"\n" . "Content-Transfer-Encoding: 8bit\n\n"; if($this->type == 'HTML') { if(count($this->inline)) while(list($ftype, $arr) = each($this->inline)) { if(count($arr)) while(list($inlName, $data) = each($arr)) { $inlType = $this->mime[$ftype] ? $this->mime[$ftype] : 'application/octet-stream'; $this->footer .= "--$uid2\n" . "Content-Type: $inlType;\n\t" . "name=\"$inlName\"\n" . "Content-ID: <$inlName>\n" . "Content-Disposition: inline;\n\t" . "filename=\"$inlName\"\n" . "Content-Transfer-Encoding: base64\n\n" . "$data\n\n"; } } $this->footer .= "--$uid2--\n\n"; } if(count($attachments)) while(list($filename, $file) = each($attachments)) { $this->footer .= "--$uid1\n" . 'Content-Type: ' . $filetype[$filename] . ";\n\t" . "name=\"$filename\"\n" . "Content-Disposition: attachment;\n\t" . "filename=\"$filename\"\n" . "Content-Transfer-Encoding: base64\n\n" . "$file\n\n"; } if($this->type == 'HTML' || $file) $this->footer .= "--$uid1--"; } function send($email) { if($this->saveDir) $this->header = str_replace("Subject:\n", 'Subject: ' . $this->subject . "\n", $this->header); else $this->header = str_replace("Subject:\n", '', $this->header); $mime_mail = $this->header . $this->body . "\n\n" . $this->footer; if($this->saveDir) { if($fp = @fopen($this->saveDir . '/mail.eml', 'w')) { $mime_mail = "To: $email\n" . $mime_mail; fwrite($fp, $mime_mail, strlen($mime_mail)); fclose($fp); $ok = true; } else $ok = false; } else { $php_ver = phpversion(); if(function_exists('ini_get')) $safe_mode = ini_get('safe_mode'); else $safe_mode = get_cfg_var('safe_mode'); if($php_ver < '4.0.5' || ($php_ver >= '4.2.3' && $safe_mode)) { $ok = @mail($email, $this->subject, '', $mime_mail); } else { $options = ($this->useQueue ? '-odq ' : '') . '-i -f ' . $this->senderMail; $ok = @mail($email, $this->subject, '', $mime_mail, $options); } } return $ok; } function create() { if(strlen($this->body) < 100) { $file = str_replace('\\', '/', $this->body); if($fp = @fopen($file, 'r')) { $this->body = fread($fp, @filesize($file)); fclose($fp); $this->documentRoot= dirname($file); } } if($this->type == 'HTML') $this->check_body(); $this->prepare(); } } ?> [/PHP] [/QUOTE]
Bilder bitte
hier hochladen
und danach über das Bild-Icon (Direktlink vorher kopieren) platzieren.
Zitate einfügen…
Authentifizierung
Wenn ▲ = 5, ▼ = 2 und ■ = 7, was ist ▲ × ▼ + ■?
Antworten
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
PHP, Javascript, jQuery, Ajax, nodeJS, MySQL...
Hilfe beim PHP Kontaktformular
Oben