Forum

Kontakt Formular funktioniert nicht

Erstellt von AchimPf, 21.07.2008.



  1. AchimPf

    AchimPf Aktives Mitglied

    Dabei seit:
    08.11.2007
    Beiträge:
    258
    Geschlecht:
    männlich
    Ort:
    Trier
    Software:
    Photoshop CS4, Illustrator CS4, Flash CS4, Dreamweaver CS4
    Kontakt Formular funktioniert nicht
    Hallo zusammen,
    ich habe mir in dreamweaver 8 ein einfaches kontaktformular erstellt.
    nach anleitung von hussein morsy (Einstig in dreamweaver 8). auf seiner internet seite kann man sich ein formail generien lassen. dieses wird ja benötigt??

    o.k. nachdem ich beide dateien, kontakt.php und myFormMail.php auf meinen server übertragen habe, hab ich einen versuch gestartet. doch es kommt folgende fehlermeldung:
    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.
    Please contact the server administrator, postmaster@achimpfeiffer-alleinunterhaltertrier.de and inform them of the time the error occurred, and anything you might have done that may have caused the error.
    More information about this error may be available in the server error log.
    Apache/2.0 Server at www.achimpfeiffer-alleinunterhaltertrier.de Port 80 :uhm: :'( :schmoll: wäre für einen hinweiß dankbar gruß achim aus trier
     
    #1      
  2. MasterJoko

    MasterJoko Erklärbär

    Dabei seit:
    12.02.2006
    Beiträge:
    111
    Geschlecht:
    männlich
    Software:
    CS3 Suite
    Kameratyp:
    Sony DSC P52
    Kontakt Formular funktioniert nicht
    AW: Kontakt Formular funktioniert nicht

    Hallo,

    - sieht danach aus, als solltest du die config einstellungen in kontakt.php und myFormMail.php mal auf richtigkeit überprüfen.

    evtl. hast du da einen alten Eintrag, und deswegen sagt der was von misconfiguration - also Fehlkonfiguration.

    poste doch mal den error log...

    mfg
     
    #2      
  3. AchimPf

    AchimPf Aktives Mitglied

    Dabei seit:
    08.11.2007
    Beiträge:
    258
    Geschlecht:
    männlich
    Ort:
    Trier
    Software:
    Photoshop CS4, Illustrator CS4, Flash CS4, Dreamweaver CS4
    Kontakt Formular funktioniert nicht
    AW: Kontakt Formular funktioniert nicht

    hi,
    wo genau find ich den error log ???
     
    #3      
  4. MasterJoko

    MasterJoko Erklärbär

    Dabei seit:
    12.02.2006
    Beiträge:
    111
    Geschlecht:
    männlich
    Software:
    CS3 Suite
    Kameratyp:
    Sony DSC P52
    Kontakt Formular funktioniert nicht
    AW: Kontakt Formular funktioniert nicht

    nach der Mitteilung zu urteilen, auf dem Server von dir.

    ansonsten poste die beiden Dateien mal, oder häng sie an, jenachdem, was dir besser erscheint.
     
    #4      
  5. AchimPf

    AchimPf Aktives Mitglied

    Dabei seit:
    08.11.2007
    Beiträge:
    258
    Geschlecht:
    männlich
    Ort:
    Trier
    Software:
    Photoshop CS4, Illustrator CS4, Flash CS4, Dreamweaver CS4
    Kontakt Formular funktioniert nicht
    AW: Kontakt Formular funktioniert nicht

    Also:
    hier der Code für´s kontakt formular:
    PHP:
    1.  
    2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd[/URL]">
    3. <html xmlns="[url=http://www.w3.org/1999/xhtml]XHTML namespace[/url]">
    4. <head>
    5. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    6. <title>Alleinunterhalter Trier Kontakt</title>
    7. <link href="../style.css" rel="stylesheet" type="text/css" />
    8. <style type="text/css">
    9. <!--
    10. .Stil1 {
    11.  font-size: 16em;
    12.  font-weight: bold;
    13.  color: #000000;
    14. }
    15. .Stil2 {
    16.  font-size: 10px;
    17.  color: #000000;
    18. }
    19. .Stil3 {color: #ECE9D8}
    20. .Stil4 {color: #000000; }
    21. -->
    22. </style>
    23. <script type="text/JavaScript">
    24. <!--
    25. function MM_findObj(n, d) { //v4.01
    26.   var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    27.     d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    28.   if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
    29.   for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
    30.   if(!x && d.getElementById) x=d.getElementById(n); return x;
    31. }
    32.  
    33. function MM_validateForm() { //v4.0
    34.   var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    35.   for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    36.     if (val) { nm=val.name; if ((val=val.value)!="") {
    37.       if (test.indexOf('isEmail')!=-1) { p=val.indexOf([EMAIL="'@'"]'@'[/EMAIL]);
    38.         if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
    39.       } else if (test!='R') { num = parseFloat(val);
    40.         if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
    41.         if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
    42.           min=test.substring(8,p); max=test.substring(p+1);
    43.           if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    44.     } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    45.   } if (errors) alert('The following error(s) occurred:\n'+errors);
    46.   document.MM_returnValue = (errors == '');
    47. }
    48. //-->
    49. </script>
    50. </head>
    51. <script src="[URL]http://www.google-analytics.com/urchin.js[/URL]" type="text/javascript">
    52. </script>
    53. <script type="text/javascript">
    54. _uacct = "UA-1942905-1";
    55. urchinTracker();
    56. </script>
    57. <body>
    58. <!-- start container -->
    59. <div id="container">
    60.  
    61. <!-- start left side content -->
    62. <div id="left">
    63.  
    64. <!-- start header -->
    65. <div id="header">
    66.   <h1>&nbsp;</h1>
    67.   <p> </p>
    68. </div>
    69. <!-- end header -->
    70.  
    71. <!-- begin section -->
    72. <div class="section">
    73. <h1 align="left">Kontakt</h1>
    74. <form action="myFormMail.php" method="post" name="form1" id="form1" onsubmit="MM_validateForm('textfield','','R','textfield3','','R','textfield2','','R','textarea','','R');return document.MM_returnValue">
    75.   <table width="100%" height="194" border="0" cellpadding="0" cellspacing="0">
    76.     <tr>
    77.       <td width="27%"><div align="center">Name</div></td>
    78.       <td width="73%"><input type="text" name="textfield" /></td>
    79.     </tr>
    80.     <tr>
    81.       <td><div align="center">Andresse / Telefon </div></td>
    82.       <td><input type="text" name="textfield3" /></td>
    83.     </tr>
    84.     <tr>
    85.       <td><div align="center">E Mail</div></td>
    86.       <td><input type="text" name="textfield2" /></td>
    87.     </tr>
    88.     <tr>
    89.       <td><div align="center">Betreff</div></td>
    90.       <td><select name="select">
    91.         <option>Anfrage</option>
    92.         <option>Demo CD zusenden</option>
    93.       </select></td>
    94.     </tr>
    95.     <tr>
    96.       <td><div align="center">Veranstalltung</div></td>
    97.       <td><select name=“Betreff“ size=“1“>
    98.         <option>Hochzeit</option>
    99.         <option>Geburtstag</
    100.           option></option>
    101.         <option>Sonstiges</option>
    102.       </select>      </td>
    103.     </tr>
    104.     <tr>
    105.       <td><div align="center">Nachricht</div></td>
    106.       <td><textarea name="textarea" cols="40" rows="10">Bitte Eintragen :</textarea></td>
    107.     </tr>
    108.     <tr>
    109.       <td><div align="center"></div></td>
    110.       <td><input type="submit" name="Submit" value="Senden" />
    111.         <input type="reset" name="Submit2" value="Zurücksetzen" />
    112.         <input name="hiddenField" type="hidden" value="[EMAIL="info@achimpfeiffer-alleinunterhaltertrier.de"]info@achimpfeiffer-alleinunterhaltertrier.de[/EMAIL]" /></td>
    113.     </tr>
    114.   </table>
    115. </form>
    116. <h2 align="center">oder Rufen sie einfach an : 0651 1700 162 oder 0171 47 44 54 7 </h2>
    117. </div>
    118. <!-- end section -->
    119.  
    120. <!-- begin section bottom -->
    121. <div class="sectionbottom"></div>
    122. <!-- end section bottom -->
    123. </div>
    124. <!-- end left side content -->
    125.  
    126. <!-- begin right side -->
    127. <div id="right">
    128. <!-- begin right section -->
    129. <div class="right">
    130. <h2>Menu</h2>
    131. <ul id="nav">
    132. <li id="active"><a href="http://www.psd-tutorials.de/modules/Forum/index.html" id="current">Home</a></li>
    133. <li><a href="http://www.psd-tutorials.de/modules/Forum/index 2.html">Über mich</a></li>
    134. <li><a href="Repertoire.htm">Repertoire</a></li>
    135. <li><a href="Wann Alleinunterhalter.html">Wozu Alleinunterhalter</a></li>
    136. <li><a href="equipment.htm">Equipment</a></li>
    137. <li><a href="Referenzen.htm">Referenzen</a></li>
    138. <li><a href="Bilder.html">Bilder</a></li>
    139. <li><a href="Duo.htm">Duo</a></li>
    140. <li><a href="Needles &amp; Pins.htm">The Moonlight´s </a></li>
    141. <li><a href="Keyboard Seminar.html">Keyboard Seminar</a></li>
    142. <li><a href="Unterricht.htm">Unterricht</a></li>
    143. <li><a href="Gutschein.htm">Gutschein</a></li>
    144. <li><a href="Gaestebuch.htm">Gästebuch</a></li>
    145. <li><a href="kontakt.htm">Kontakt</a></li>
    146. <li><a href="Links.htm">Links</a></li>
    147. <li><a href="Impressum.htm">Impressum</a></li>
    148. </ul>
    149. </div>
    150. <!-- end right section -->
    151.  
    152. <div class="rightbottom"><!-- empty div --></div>
    153.  
    154. <!-- begin right section -->
    155. <div class="right">
    156. <h2>News</h2>
    157. <p>&nbsp;</p>
    158. </div>
    159. <!-- end right section -->
    160.  
    161. <div class="rightbottom"><p><a href="http://www.psd-tutorials.de/modules/Forum/index.html">Read more &raquo;</a></p></div>
    162.  
    163. </div>
    164. <!-- end right side -->
    165.  
    166.  
    167. </div>
    168. <!-- end container -->
    169. </body>
    170. </html>
    171.  
    172. __________________________________________________________________
    173. und hier der Quellcode der myForm Datei:
    174. <?php
    175. /**
    176.  * myFormMail.php generated from [url=http://www.dreamweaver-buch.de]Dreamweaver CS3 Buch :: Details[/url]
    177.  *
    178.  * This program is free software; you can redistribute it and/or modify
    179.  * it under the terms of the BSD License.
    180.  * (Es wird keine Haftung fuer Fehler uebernommen)
    181.  *
    182.  * Copyright(c) 2004 by Hussein Morsy. All rights reserved.
    183.  *
    184.  * To contact the author write to [EMAIL="{@link"]{@link[/EMAIL] [EMAIL="hussein@morsye.de"]mailto:hussein@morsye.de[/EMAIL] Hussein Morsy}
    185.  * The Script is generated from
    186.  * [EMAIL="{@link"]{@link[/EMAIL] [url=http://www.dreamweaver-buch.de]Dreamweaver CS3 Buch :: Details[/url]}
    187.  *
    188.  * @author Hussein Morsy <[EMAIL="hussein@morsy.de"]hussein@morsy.de[/EMAIL]>
    189.  * @version $Revision: 1.5 $  $Date: 2005/02/17 17:53:17 $
    190.  */
    191.  
    192.  
    193.  // Backward compatible array creation. After this point, the
    194.  // PHP 4.1.0+ arrays can be used to access variables coming
    195.  // from outside PHP. But it should be noted that these variables
    196.  // are not necessarily superglobals, so they need to be global-ed!
    197.  if (!isset($_SERVER))
    198.  {
    199.     $_GET=$HTTP_GET_VARS;
    200.     $_POST=&$HTTP_POST_VARS;
    201.     $_SERVER=&$HTTP_SERVER_VARS;
    202.     $_FILES=&$HTTP_POST_VARS;
    203.  }
    204.  
    205.   $PHP_SELF = $_SERVER['PHP_SELF'];
    206.  
    207.  
    208.  
    209.  /* Generierte Eintraege. Koeenen auch von "Hand" geaendert werden */
    210.  $recipients   = [EMAIL="'info@achimpfeiffer-alleinunterhaltertrier.de'"]'info@achimpfeiffer-alleinunterhaltertrier.de'[/EMAIL];
    211.  $subject    = 'Anfrage';
    212.  $introtext   = 'Sie haben folgende Formulardaten erhalten:';
    213.  $redirect   = 'danke.html';
    214.  $max_filesize  = '100';
    215.  $upload_extensions = 'jpg, gif, png, pdf';
    216.  $max_files   = '0';
    217.  
    218.  
    219.  
    220.  /* Formularfelder einlesen */
    221.  $inputs = &$_POST;
    222.  
    223.  /* E-Mail-Text generieren */
    224.  $body=$introtext . "\r\n";
    225.  if(count($inputs)) {
    226.   foreach($inputs as $key=>$val) {
    227.    $body .= "$key: $val\n";
    228.   }
    229.   $mail =  new phpmailer();
    230.   $mail->Subject = $subject;
    231.   $mail->From     = $inputs['email'];
    232.   $mail->FromName = "$inputs[vorname] $inputs[nachname] $inputs[name]";
    233.   $mail->Body = $body;  
    234.  
    235.   //eine oder mehrere Adressen (jeweils durch Komma getrennt) werden hinzugefuegt
    236.   $recipientList = explode(',',$recipients);
    237.   foreach($recipientList as $recipient) {
    238.    //Leerzeichen am Anfang und am ende entfernen
    239.    $recipient = trim($recipient);
    240.    $mail->AddAddress($recipient);
    241.   }
    242.  
    243.   //Attachments hinzufuegen
    244.   $count_uploaded = 0;
    245.   foreach($_FILES as $name=>$data) {
    246.    if(!empty($data['tmp_name'])) {
    247.     if($count_uploaded < $max_files) {
    248.      $count_uploaded++;
    249.      $file = $data['tmp_name'];
    250.      $filesize = round($data['size'] / 1024, 2);
    251.      if($filesize <= $max_filesize) {
    252.       // alle Punkte falls vorhanden entfernen
    253.       $upload_extensions = str_replace('.','',$upload_extensions);
    254.       $extensions = split(',',$upload_extensions);
    255.       $ext_found = false;
    256.       foreach($extensions as $ext) {
    257.        $ext = trim($ext);
    258.        if ( strrchr($data['name'],'.') == ".$ext") {
    259.         $mail->AddAttachment($file,"$name.$ext");
    260.         $ext_found=true;
    261.         break;
    262.        }
    263.       }
    264.       if(!$ext_found) {
    265.        $body .= "\r\n Datei $data[name] (Feld $name) wurde wegen nicht zugelassener Dateiendung nicht uebertragen. Erlaubt waren nur $upload_extensions \r\n";
    266.       }
    267.      }
    268.      else {
    269.        $body .= "\r\n Datei $data[name] (Feld $name) wurde wegen ueberschreitung der Dateigroesse $filesize nicht uebertragen Erlaubt waren nur $max_filesize\r\n";
    270.      }
    271.      
    272.     }
    273.     else {
    274.      $body.="\r\nAnzahl ($max_files) erlaubter Dateiuploads ueberschritten.\r\n";
    275.     }
    276.    }
    277.    else {
    278.     outputError( "Datei existiert nicht: " , $data['tmp_name']);
    279.     die();
    280.    }
    281.   }
    282.   $mail->Body = $body;
    283.   //senden der EMail
    284.   if($mail->Send()) {
    285.    header("Location: $redirect");
    286.   }else {
    287.    outputError("Aufgrund eines Fehlers konnten die Formulareingaben nicht per E-Mail &uuml;bertragen werden");
    288.   }
    289.  }else {
    290.   outputError("Das Formular wurde nicht abgeschickt, da das Formular nicht ausgef&uuml;llt wurde.");
    291.  }
    292.  
    293.  
    294. function outputError($message) {
    295.  $html = <<<HTML_EOT
    296.  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    297.    "[URL]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd[/URL]">
    298.  <html xmlns="[url=http://www.w3.org/1999/xhtml]XHTML namespace[/url]" xml:lang="de" lang="de">
    299.  <head>
    300.   <meta http-equiv="content-type" content="text/html; charset=windows-1252" />
    301.   <title>Fehler</title>
    302.  </head>
    303.  <body>
    304.   <h3> Fehler </h3>
    305.   <p>$message </p>
    306.  </body>
    307.  </html>
    308. HTML_EOT;
    309. }
    310.  
    311.  
    312.  
    313. ////////////////////////////////////////////////////
    314. // PHPMailer - PHP email class
    315. //
    316. // Class for sending email using either
    317. // sendmail, PHP mail(), or SMTP.  Methods are
    318. // based upon the standard AspEmail(tm) classes.
    319. //
    320. // Copyright (C) 2001 - 2003  Brent R. Matzelle
    321. //
    322. // License: LGPL, see LICENSE
    323. ////////////////////////////////////////////////////
    324.  
    325. /**
    326.  * PHPMailer - PHP email transport class
    327.  * @package PHPMailer
    328.  * @author Brent R. Matzelle
    329.  * @copyright 2001 - 2003 Brent R. Matzelle
    330.  */
    331. class PHPMailer
    332. {
    333.     /////////////////////////////////////////////////
    334.     // PUBLIC VARIABLES
    335.     /////////////////////////////////////////////////
    336.  
    337.     /**
    338.      * Email priority (1 = High, 3 = Normal, 5 = low).
    339.      * @var int
    340.      */
    341.     var $Priority          = 3;
    342.  
    343.     /**
    344.      * Sets the CharSet of the message.
    345.      * @var string
    346.      */
    347.     var $CharSet           = "iso-8859-1";
    348.  
    349.     /**
    350.      * Sets the Content-type of the message.
    351.      * @var string
    352.      */
    353.     var $ContentType        = "text/plain";
    354.  
    355.     /**
    356.      * Sets the Encoding of the message. Options for this are "8bit",
    357.      * "7bit", "binary", "base64", and "quoted-printable".
    358.      * @var string
    359.      */
    360.     var $Encoding          = "8bit";
    361.  
    362.     /**
    363.      * Holds the most recent mailer error message.
    364.      * @var string
    365.      */
    366.     var $ErrorInfo         = "";
    367.  
    368.     /**
    369.      * Sets the From email address for the message.
    370.      * @var string
    371.      */
    372.     var $From               = "[EMAIL="root@localhost"]root@localhost[/EMAIL]";
    373.  
    374.     /**
    375.      * Sets the From name of the message.
    376.      * @var string
    377.      */
    378.     var $FromName           = "Root User";
    379.  
    380.     /**
    381.      * Sets the Sender email (Return-Path) of the message.  If not empty,
    382.      * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
    383.      * @var string
    384.      */
    385.     var $Sender            = "";
    386.  
    387.     /**
    388.      * Sets the Subject of the message.
    389.      * @var string
    390.      */
    391.     var $Subject           = "";
    392.  
    393.     /**
    394.      * Sets the Body of the message.  This can be either an HTML or text body.
    395.      * If HTML then run IsHTML(true).
    396.      * @var string
    397.      */
    398.     var $Body               = "";
    399.  
    400.     /**
    401.      * Sets the text-only body of the message.  This automatically sets the
    402.      * email to multipart/alternative.  This body can be read by mail
    403.      * clients that do not have HTML email capability such as mutt. Clients
    404.      * that can read HTML will view the normal Body.
    405.      * @var string
    406.      */
    407.     var $AltBody           = "";
    408.  
    409.     /**
    410.      * Sets word wrapping on the body of the message to a given number of
    411.      * characters.
    412.      * @var int
    413.      */
    414.     var $WordWrap          = 0;
    415.  
    416.     /**
    417.      * Method to send mail: ("mail", "sendmail", or "smtp").
    418.      * @var string
    419.      */
    420.     var $Mailer            = "mail";
    421.  
    422.     /**
    423.      * Sets the path of the sendmail program.
    424.      * @var string
    425.      */
    426.     var $Sendmail          = "/usr/sbin/sendmail";
    427.    
    428.     /**
    429.      * Path to PHPMailer plugins.  This is now only useful if the SMTP class
    430.      * is in a different directory than the PHP include path.  
    431.      * @var string
    432.      */
    433.     var $PluginDir         = "";
    434.  
    435.     /**
    436.      *  Holds PHPMailer version.
    437.      *  @var string
    438.      */
    439.     var $Version           = "1.72";
    440.  
    441.     /**
    442.      * Sets the email address that a reading confirmation will be sent.
    443.      * @var string
    444.      */
    445.     var $ConfirmReadingTo  = "";
    446.  
    447.     /**
    448.      *  Sets the hostname to use in Message-Id and Received headers
    449.      *  and as default HELO string. If empty, the value returned
    450.      *  by SERVER_NAME is used or 'localhost.localdomain'.
    451.      *  @var string
    452.      */
    453.     var $Hostname          = "";
    454.  
    455.     /////////////////////////////////////////////////
    456.     // SMTP VARIABLES
    457.     /////////////////////////////////////////////////
    458.  
    459.     /**
    460.      *  Sets the SMTP hosts.  All hosts must be separated by a
    461.      *  semicolon.  You can also specify a different port
    462.      *  for each host by using this format: [hostname:port]
    463.      *  (e.g. "smtp1.example.com:25;smtp2.example.com").
    464.      *  Hosts will be tried in order.
    465.      *  @var string
    466.      */
    467.     var $Host        = "localhost";
    468.  
    469.     /**
    470.      *  Sets the default SMTP server port.
    471.      *  @var int
    472.      */
    473.     var $Port        = 25;
    474.  
    475.     /**
    476.      *  Sets the SMTP HELO of the message (Default is $Hostname).
    477.      *  @var string
    478.      */
    479.     var $Helo        = "";
    480.  
    481.     /**
    482.      *  Sets SMTP authentication. Utilizes the Username and Password variables.
    483.      *  @var bool
    484.      */
    485.     var $SMTPAuth     = false;
    486.  
    487.     /**
    488.      *  Sets SMTP username.
    489.      *  @var string
    490.      */
    491.     var $Username     = "";
    492.  
    493.     /**
    494.      *  Sets SMTP password.
    495.      *  @var string
    496.      */
    497.     var $Password     = "";
    498.  
    499.     /**
    500.      *  Sets the SMTP server timeout in seconds. This function will not
    501.      *  work with the win32 version.
    502.      *  @var int
    503.      */
    504.     var $Timeout      = 10;
    505.  
    506.     /**
    507.      *  Sets SMTP class debugging on or off.
    508.      *  @var bool
    509.      */
    510.     var $SMTPDebug    = false;
    511.  
    512.     /**
    513.      * Prevents the SMTP connection from being closed after each mail
    514.      * sending.  If this is set to true then to close the connection
    515.      * requires an explicit call to SmtpClose().
    516.      * @var bool
    517.      */
    518.     var $SMTPKeepAlive = false;
    519.  
    520.     /**#@+
    521.      * @access private
    522.      */
    523.     var $smtp            = NULL;
    524.     var $to              = array();
    525.     var $cc              = array();
    526.     var $bcc             = array();
    527.     var $ReplyTo         = array();
    528.     var $attachment      = array();
    529.     var $CustomHeader    = array();
    530.     var $message_type    = "";
    531.     var $boundary        = array();
    532.     var $language        = array();
    533.     var $error_count     = 0;
    534.     var $LE              = "\n";
    535.     /**#@-*/
    536.    
    537.     /////////////////////////////////////////////////
    538.     // VARIABLE METHODS
    539.     /////////////////////////////////////////////////
    540.  
    541.     /**
    542.      * Sets message type to HTML.  
    543.      * @param bool $bool
    544.      * @return void
    545.      */
    546.     function IsHTML($bool) {
    547.         if($bool == true)
    548.             $this->ContentType = "text/html";
    549.         else
    550.             $this->ContentType = "text/plain";
    551.     }
    552.  
    553.     /**
    554.      * Sets Mailer to send message using SMTP.
    555.      * @return void
    556.      */
    557.     function IsSMTP() {
    558.         $this->Mailer = "smtp";
    559.     }
    560.  
    561.     /**
    562.      * Sets Mailer to send message using PHP mail() function.
    563.      * @return void
    564.      */
    565.     function IsMail() {
    566.         $this->Mailer = "mail";
    567.     }
    568.  
    569.     /**
    570.      * Sets Mailer to send message using the $Sendmail program.
    571.      * @return void
    572.      */
    573.     function IsSendmail() {
    574.         $this->Mailer = "sendmail";
    575.     }
    576.  
    577.     /**
    578.      * Sets Mailer to send message using the qmail MTA.
    579.      * @return void
    580.      */
    581.     function IsQmail() {
    582.         $this->Sendmail = "/var/qmail/bin/sendmail";
    583.         $this->Mailer = "sendmail";
    584.     }
    585.  
    586.  
    587.     /////////////////////////////////////////////////
    588.     // RECIPIENT METHODS
    589.     /////////////////////////////////////////////////
    590.  
    591.     /**
    592.      * Adds a "To" address.  
    593.      * @param string $address
    594.      * @param string $name
    595.      * @return void
    596.      */
    597.     function AddAddress($address, $name = "") {
    598.         $cur = count($this->to);
    599.         $this->to[$cur][0] = trim($address);
    600.         $this->to[$cur][1] = $name;
    601.     }
    602.  
    603.     /**
    604.      * Adds a "Cc" address. Note: this function works
    605.      * with the SMTP mailer on win32, not with the "mail"
    606.      * mailer.  
    607.      * @param string $address
    608.      * @param string $name
    609.      * @return void
    610.     */
    611.     function AddCC($address, $name = "") {
    612.         $cur = count($this->cc);
    613.         $this->cc[$cur][0] = trim($address);
    614.         $this->cc[$cur][1] = $name;
    615.     }
    616.  
    617.     /**
    618.      * Adds a "Bcc" address. Note: this function works
    619.      * with the SMTP mailer on win32, not with the "mail"
    620.      * mailer.  
    621.      * @param string $address
    622.      * @param string $name
    623.      * @return void
    624.      */
    625.     function AddBCC($address, $name = "") {
    626.         $cur = count($this->bcc);
    627.         $this->bcc[$cur][0] = trim($address);
    628.         $this->bcc[$cur][1] = $name;
    629.     }
    630.  
    631.     /**
    632.      * Adds a "Reply-to" address.  
    633.      * @param string $address
    634.      * @param string $name
    635.      * @return void
    636.      */
    637.     function AddReplyTo($address, $name = "") {
    638.         $cur = count($this->ReplyTo);
    639.         $this->ReplyTo[$cur][0] = trim($address);
    640.         $this->ReplyTo[$cur][1] = $name;
    641.     }
    642.  
    643.  
    644.     /////////////////////////////////////////////////
    645.     // MAIL SENDING METHODS
    646.     /////////////////////////////////////////////////
    647.  
    648.     /**
    649.      * Creates message and assigns Mailer. If the message is
    650.      * not sent successfully then it returns false.  Use the ErrorInfo
    651.      * variable to view description of the error.  
    652.      * @return bool
    653.      */
    654.     function Send() {
    655.         $header = "";
    656.         $body = "";
    657.         $result = true;
    658.  
    659.         if((count($this->to) + count($this->cc) + count($this->bcc)) < 1)
    660.         {
    661.             $this->SetError($this->Lang("provide_address"));
    662.             return false;
    663.         }
    664.  
    665.         // Set whether the message is multipart/alternative
    666.         if(!empty($this->AltBody))
    667.             $this->ContentType = "multipart/alternative";
    668.  
    669.         $this->error_count = 0; // reset errors
    670.         $this->SetMessageType();
    671.         $header .= $this->CreateHeader();
    672.         $body = $this->CreateBody();
    673.  
    674.         if($body == "") { return false; }
    675.  
    676.         // Choose the mailer
    677.         switch($this->Mailer)
    678.         {
    679.             case "sendmail":
    680.                 $result = $this->SendmailSend($header, $body);
    681.                 break;
    682.             case "mail":
    683.                 $result = $this->MailSend($header, $body);
    684.                 break;
    685.             case "smtp":
    686.                 $result = $this->SmtpSend($header, $body);
    687.                 break;
    688.             default:
    689.             $this->SetError($this->Mailer . $this->Lang("mailer_not_supported"));
    690.                 $result = false;
    691.                 break;
    692.         }
    693.  
    694.         return $result;
    695.     }
    696.    
    697.     /**
    698.      * Sends mail using the $Sendmail program.  
    699.      * @access private
    700.      * @return bool
    701.      */
    702.     function SendmailSend($header, $body) {
    703.         if ($this->Sender != "")
    704.             $sendmail = sprintf("%s -oi -f %s -t", $this->Sendmail, $this->Sender);
    705.         else
    706.             $sendmail = sprintf("%s -oi -t", $this->Sendmail);
    707.  
    708.         if([EMAIL="!@$mail"]!@$mail[/EMAIL] = popen($sendmail, "w"))
    709.         {
    710.             $this->SetError($this->Lang("execute") . $this->Sendmail);
    711.             return false;
    712.         }
    713.  
    714.         fputs($mail, $header);
    715.         fputs($mail, $body);
    716.        
    717.         $result = pclose($mail) >> 8 & 0xFF;
    718.         if($result != 0)
    719.         {
    720.             $this->SetError($this->Lang("execute") . $this->Sendmail);
    721.             return false;
    722.         }
    723.  
    724.         return true;
    725.     }
    726.  
    727.     /**
    728.      * Sends mail using the PHP mail() function.  
    729.      * @access private
    730.      * @return bool
    731.      */
    732.     function MailSend($header, $body) {
    733.         $to = "";
    734.         for($i = 0; $i < count($this->to); $i++)
    735.         {
    736.             if($i != 0) { $to .= ", "; }
    737.             $to .= $this->to[$i][0];
    738.         }
    739.  
    740.         if ($this->Sender != "" && strlen(ini_get("safe_mode"))< 1)
    741.         {
    742.             $old_from = ini_get("sendmail_from");
    743.             ini_set("sendmail_from", $this->Sender);
    744.             $params = sprintf("-oi -f %s", $this->Sender);
    745.             $rt = @mail($to, $this->EncodeHeader($this->Subject), $body,
    746.                         $header, $params);
    747.         }
    748.         else
    749.             $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, $header);
    750.  
    751.         if (isset($old_from))
    752.             ini_set("sendmail_from", $old_from);
    753.  
    754.         if(!$rt)
    755.         {
    756.             $this->SetError($this->Lang("instantiate"));
    757.             return false;
    758.         }
    759.  
    760.         return true;
    761.     }
    762.  
    763.     /**
    764.      * Sends mail via SMTP using PhpSMTP (Author:
    765.      * Chris Ryan).  Returns bool.  Returns false if there is a
    766.      * bad MAIL FROM, RCPT, or DATA input.
    767.      * @access private
    768.      * @return bool
    769.      */
    770.     function SmtpSend($header, $body) {
    771.         include_once($this->PluginDir . "class.smtp.php");
    772.         $error = "";
    773.         $bad_rcpt = array();
    774.  
    775.         if(!$this->SmtpConnect())
    776.             return false;
    777.  
    778.         $smtp_from = ($this->Sender == "") ? $this->From : $this->Sender;
    779.         if(!$this->smtp->Mail($smtp_from))
    780.         {
    781.             $error = $this->Lang("from_failed") . $smtp_from;
    782.             $this->SetError($error);
    783.             $this->smtp->Reset();
    784.             return false;
    785.         }
    786.  
    787.         // Attempt to send attach all recipients
    788.         for($i = 0; $i < count($this->to); $i++)
    789.         {
    790.             if(!$this->smtp->Recipient($this->to[$i][0]))
    791.                 $bad_rcpt[] = $this->to[$i][0];
    792.         }
    793.         for($i = 0; $i < count($this->cc); $i++)
    794.         {
    795.             if(!$this->smtp->Recipient($this->cc[$i][0]))
    796.                 $bad_rcpt[] = $this->cc[$i][0];
    797.         }
    798.         for($i = 0; $i < count($this->bcc); $i++)
    799.         {
    800.             if(!$this->smtp->Recipient($this->bcc[$i][0]))
    801.                 $bad_rcpt[] = $this->bcc[$i][0];
    802.         }
    803.  
    804.         if(count($bad_rcpt) > 0) // Create error message
    805.         {
    806.             for($i = 0; $i < count($bad_rcpt); $i++)
    807.             {
    808.                 if($i != 0) { $error .= ", "; }
    809.                 $error .= $bad_rcpt[$i];
    810.             }
    811.             $error = $this->Lang("recipients_failed") . $error;
    812.             $this->SetError($error);
    813.             $this->smtp->Reset();
    814.             return false;
    815.         }
    816.  
    817.         if(!$this->smtp->Data($header . $body))
    818.         {
    819.             $this->SetError($this->Lang("data_not_accepted"));
    820.             $this->smtp->Reset();
    821.             return false;
    822.         }
    823.         if($this->SMTPKeepAlive == true)
    824.             $this->smtp->Reset();
    825.         else
    826.             $this->SmtpClose();
    827.  
    828.         return true;
    829.     }
    830.  
    831.     /**
    832.      * Initiates a connection to an SMTP server.  Returns false if the
    833.      * operation failed.
    834.      * @access private
    835.      * @return bool
    836.      */
    837.     function SmtpConnect() {
    838.         if($this->smtp == NULL) { $this->smtp = new SMTP(); }
    839.  
    840.         $this->smtp->do_debug = $this->SMTPDebug;
    841.         $hosts = explode(";", $this->Host);
    842.         $index = 0;
    843.         $connection = ($this->smtp->Connected());
    844.  
    845.         // Retry while there is no connection
    846.         while($index < count($hosts) && $connection == false)
    847.         {
    848.             if(strstr($hosts[$index], ":"))
    849.                 list($host, $port) = explode(":", $hosts[$index]);
    850.             else
    851.             {
    852.                 $host = $hosts[$index];
    853.                 $port = $this->Port;
    854.             }
    855.  
    856.             if($this->smtp->Connect($host, $port, $this->Timeout))
    857.             {
    858.                 if ($this->Helo != '')
    859.                     $this->smtp->Hello($this->Helo);
    860.                 else
    861.                     $this->smtp->Hello($this->ServerHostname());
    862.        
    863.                 if($this->SMTPAuth)
    864.                 {
    865.                     if(!$this->smtp->Authenticate($this->Username,
    866.                                                   $this->Password))
    867.                     {
    868.                         $this->SetError($this->Lang("authenticate"));
    869.                         $this->smtp->Reset();
    870.                         $connection = false;
    871.                     }
    872.                 }
    873.                 $connection = true;
    874.             }
    875.             $index++;
    876.         }
    877.         if(!$connection)
    878.             $this->SetError($this->Lang("connect_host"));
    879.  
    880.         return $connection;
    881.     }
    882.  
    883.     /**
    884.      * Closes the active SMTP session if one exists.
    885.      * @return void
    886.      */
    887.     function SmtpClose() {
    888.         if($this->smtp != NULL)
    889.         {
    890.             if($this->smtp->Connected())
    891.             {
    892.                 $this->smtp->Quit();
    893.                 $this->smtp->Close();
    894.             }
    895.         }
    896.     }
    897.  
    898.     /**
    899.      * Sets the language for all class error messages.  Returns false
    900.      * if it cannot load the language file.  The default language type
    901.      * is English.
    902.      * @param string $lang_type Type of language (e.g. Portuguese: "br")
    903.      * @param string $lang_path Path to the language file directory
    904.      * @access public
    905.      * @return bool
    906.      */
    907.     function SetLanguage($lang_type, $lang_path = "language/") {
    908.         if(file_exists($lang_path.'phpmailer.lang-'.$lang_type.'.php'))
    909.             include($lang_path.'phpmailer.lang-'.$lang_type.'.php');
    910.         else if(file_exists($lang_path.'phpmailer.lang-en.php'))
    911.             include($lang_path.'phpmailer.lang-en.php');
    912.         else
    913.         {
    914.             $this->SetError("Could not load language file");
    915.             return false;
    916.         }
    917.         $this->language = $PHPMAILER_LANG;
    918.    
    919.         return true;
    920.     }
    921.  
    922.     /////////////////////////////////////////////////
    923.     // MESSAGE CREATION METHODS
    924.     /////////////////////////////////////////////////
    925.  
    926.     /**
    927.      * Creates recipient headers.  
    928.      * @access private
    929.      * @return string
    930.      */
    931.     function AddrAppend($type, $addr) {
    932.         $addr_str = $type . ": ";
    933.         $addr_str .= $this->AddrFormat($addr[0]);
    934.         if(count($addr) > 1)
    935.         {
    936.             for($i = 1; $i < count($addr); $i++)
    937.                 $addr_str .= ", " . $this->AddrFormat($addr[$i]);
    938.         }
    939.         $addr_str .= $this->LE;
    940.  
    941.         return $addr_str;
    942.     }
    943.    
    944.     /**
    945.      * Formats an address correctly.
    946.      * @access private
    947.      * @return string
    948.      */
    949.     function AddrFormat($addr) {
    950.         if(empty($addr[1]))
    951.             $formatted = $addr[0];
    952.         else
    953.         {
    954.             $formatted = $this->EncodeHeader($addr[1], 'phrase') . " <" .
    955.                          $addr[0] . ">";
    956.         }
    957.  
    958.         return $formatted;
    959.     }
    960.  
    961.     /**
    962.      * Wraps message for use with mailers that do not
    963.      * automatically perform wrapping and for quoted-printable.
    964.      * Original written by philippe.  
    965.      * @access private
    966.      * @return string
    967.      */
    968.     function WrapText($message, $length, $qp_mode = false) {
    969.         $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
    970.  
    971.         $message = $this->FixEOL($message);
    972.         if (substr($message, -1) == $this->LE)
    973.             $message = substr($message, 0, -1);
    974.  
    975.         $line = explode($this->LE, $message);
    976.         $message = "";
    977.         for ($i=0 ;$i < count($line); $i++)
    978.         {
    979.           $line_part = explode(" ", $line[$i]);
    980.           $buf = "";
    981.           for ($e = 0; $e<count($line_part); $e++)
    982.           {
    983.               $word = $line_part[$e];
    984.               if ($qp_mode and (strlen($word) > $length))
    985.               {
    986.                 $space_left = $length - strlen($buf) - 1;
    987.                 if ($e != 0)
    988.                 {
    989.                     if ($space_left > 20)
    990.                     {
    991.                         $len = $space_left;
    992.                         if (substr($word, $len - 1, 1) == "=")
    993.                           $len--;
    994.                         elseif (substr($word, $len - 2, 1) == "=")
    995.                           $len -= 2;
    996.                         $part = substr($word, 0, $len);
    997.                         $word = substr($word, $len);
    998.                         $buf .= " " . $part;
    999.                         $message .= $buf . sprintf("=%s", $this->LE);
    1000.                     }
    1001.                     else
    1002.                     {
    1003.                         $message .= $buf . $soft_break;
    1004.                     }
    1005.                     $buf = "";
    1006.                 }
    1007.                 while (strlen($word) > 0)
    1008.                 {
    1009.                     $len = $length;
    1010.                     if (substr($word, $len - 1, 1) == "=")
    1011.                         $len--;
    1012.                     elseif (substr($word, $len - 2, 1) == "=")
    1013.                         $len -= 2;
    1014.                     $part = substr($word, 0, $len);
    1015.                     $word = substr($word, $len);
    1016.  
    1017.                     if (strlen($word) > 0)
    1018.                         $message .= $part . sprintf("=%s", $this->LE);
    1019.                     else
    1020.                         $buf = $part;
    1021.                 }
    1022.               }
    1023.               else
    1024.               {
    1025.                 $buf_o = $buf;
    1026.                 $buf .= ($e == 0) ? $word : (" " . $word);
    1027.  
    1028.                 if (strlen($buf) > $length and $buf_o != "")
    1029.                 {
    1030.                     $message .= $buf_o . $soft_break;
    1031.                     $buf = $word;
    1032.                 }
    1033.               }
    1034.           }
    1035.           $message .= $buf . $this->LE;
    1036.         }
    1037.  
    1038.         return $message;
    1039.     }
    1040.    
    1041.     /**
    1042.      * Set the body wrapping.
    1043.      * @access private
    1044.      * @return void
    1045.      */
    1046.     function SetWordWrap() {
    1047.         if($this->WordWrap < 1)
    1048.             return;
    1049.            
    1050.         switch($this->message_type)
    1051.         {
    1052.            case "alt":
    1053.               // fall through
    1054.            case "alt_attachment":
    1055.               $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
    1056.               break;
    1057.            default:
    1058.               $this->Body = $this->WrapText($this->Body, $this->WordWrap);
    1059.               break;
    1060.         }
    1061.     }
    1062.  
    1063.     /**
    1064.      * Assembles message header.  
    1065.      * @access private
    1066.      * @return string
    1067.      */
    1068.     function CreateHeader() {
    1069.         $result = "";
    1070.        
    1071.         // Set the boundaries
    1072.         $uniq_id = md5(uniqid(time()));
    1073.         $this->boundary[1] = "b1_" . $uniq_id;
    1074.         $this->boundary[2] = "b2_" . $uniq_id;
    1075.  
    1076.         $result .= $this->HeaderLine("Date", $this->RFCDate());
    1077.         if($this->Sender == "")
    1078.             $result .= $this->HeaderLine("Return-Path", trim($this->From));
    1079.         else
    1080.             $result .= $this->HeaderLine("Return-Path", trim($this->Sender));
    1081.        
    1082.         // To be created automatically by mail()
    1083.         if($this->Mailer != "mail")
    1084.         {
    1085.             if(count($this->to) > 0)
    1086.                 $result .= $this->AddrAppend("To", $this->to);
    1087.             else if (count($this->cc) == 0)
    1088.                 $result .= $this->HeaderLine("To", "undisclosed-recipients:;");
    1089.             if(count($this->cc) > 0)
    1090.                 $result .= $this->AddrAppend("Cc", $this->cc);
    1091.         }
    1092.  
    1093.         $from = array();
    1094.         $from[0][0] = trim($this->From);
    1095.         $from[0][1] = $this->FromName;
    1096.         $result .= $this->AddrAppend("From", $from);
    1097.  
    1098.         // sendmail and mail() extract Bcc from the header before sending
    1099.         if((($this->Mailer == "sendmail") || ($this->Mailer == "mail")) && (count($this->bcc) > 0))
    1100.             $result .= $this->AddrAppend("Bcc", $this->bcc);
    1101.  
    1102.         if(count($this->ReplyTo) > 0)
    1103.             $result .= $this->AddrAppend("Reply-to", $this->ReplyTo);
    1104.  
    1105.         // mail() sets the subject itself
    1106.         if($this->Mailer != "mail")
    1107.             $result .= $this->HeaderLine("Subject", $this->EncodeHeader(trim($this->Subject)));
    1108.  
    1109.         $result .= sprintf("Message-ID: <[EMAIL="%s@%s>%s"]%s@%s>%s[/EMAIL]", $uniq_id, $this->ServerHostname(), $this->LE);
    1110.         $result .= $this->HeaderLine("X-Priority", $this->Priority);
    1111.         $result .= $this->HeaderLine("X-Mailer", "PHPMailer [version " . $this->Version . "]");
    1112.        
    1113.         if($this->ConfirmReadingTo != "")
    1114.         {
    1115.             $result .= $this->HeaderLine("Disposition-Notification-To",
    1116.                        "<" . trim($this->ConfirmReadingTo) . ">");
    1117.         }
    1118.  
    1119.         // Add custom headers
    1120.         for($index = 0; $index < count($this->CustomHeader); $index++)
    1121.         {
    1122.             $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]),
    1123.                        $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
    1124.         }
    1125.         $result .= $this->HeaderLine("MIME-Version", "1.0");
    1126.  
    1127.         switch($this->message_type)
    1128.         {
    1129.             case "plain":
    1130.                 $result .= $this->HeaderLine("Content-Transfer-Encoding", $this->Encoding);
    1131.                 $result .= sprintf("Content-Type: %s; charset=\"%s\"",
    1132.                                     $this->ContentType, $this->CharSet);
    1133.                 break;
    1134.             case "attachments":
    1135.                 // fall through
    1136.             case "alt_attachments":
    1137.                 if($this->InlineImageExists())
    1138.                 {
    1139.                     $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s",
    1140.                                     "multipart/related", $this->LE, $this->LE,
    1141.                                     $this->boundary[1], $this->LE);
    1142.                 }
    1143.                 else
    1144.                 {
    1145.                     $result .= $this->HeaderLine("Content-Type", "multipart/mixed;");
    1146.                     $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
    1147.                 }
    1148.                 break;
    1149.             case "alt":
    1150.                 $result .= $this->HeaderLine("Content-Type", "multipart/alternative;");
    1151.                 $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
    1152.                 break;
    1153.         }
    1154.  
    1155.         if($this->Mailer != "mail")
    1156.             $result .= $this->LE.$this->LE;
    1157.  
    1158.         return $result;
    1159.     }
    1160.  
    1161.     /**
    1162.      * Assembles the message body.  Returns an empty string on failure.
    1163.      * @access private
    1164.      * @return string
    1165.      */
    1166.     function CreateBody() {
    1167.         $result = "";
    1168.  
    1169.         $this->SetWordWrap();
    1170.  
    1171.         switch($this->message_type)
    1172.         {
    1173.             case "alt":
    1174.                 $result .= $this->GetBoundary($this->boundary[1], "",
    1175.                                               "text/plain", "");
    1176.                 $result .= $this->EncodeString($this->AltBody, $this->Encoding);
    1177.                 $result .= $this->LE.$this->LE;
    1178.                 $result .= $this->GetBoundary($this->boundary[1], "",
    1179.                                               "text/html", "");
    1180.                
    1181.                 $result .= $this->EncodeString($this->Body, $this->Encoding);
    1182.                 $result .= $this->LE.$this->LE;
    1183.    
    1184.                 $result .= $this->EndBoundary($this->boundary[1]);
    1185.                 break;
    1186.             case "plain":
    1187.                 $result .= $this->EncodeString($this->Body, $this->Encoding);
    1188.                 break;
    1189.             case "attachments":
    1190.                 $result .= $this->GetBoundary($this->boundary[1], "", "", "");
    1191.                 $result .= $this->EncodeString($this->Body, $this->Encoding);
    1192.                 $result .= $this->LE;
    1193.      
    1194.                 $result .= $this->AttachAll();
    1195.                 break;
    1196.             case "alt_attachments":
    1197.                 $result .= sprintf("--%s%s", $this->boundary[1], $this->LE);
    1198.                 $result .= sprintf("Content-Type: %s;%s" .
    1199.                                    "\tboundary=\"%s\"%s",
    1200.                                    "multipart/alternative", $this->LE,
    1201.                                    $this->boundary[2], $this->LE.$this->LE);
    1202.    
    1203.                 // Create text body
    1204.                 $result .= $this->GetBoundary($this->boundary[2], "",
    1205.                                               "text/plain", "") . $this->LE;
    1206.  
    1207.                 $result .= $this->EncodeString($this->AltBody, $this->Encoding);
    1208.                 $result .= $this->LE.$this->LE;
    1209.    
    1210.                 // Create the HTML body
    1211.                 $result .= $this->GetBoundary($this->boundary[2], "",
    1212.                                               "text/html", "") . $this->LE;
    1213.    
    1214.                 $result .= $this->EncodeString($this->Body, $this->Encoding);
    1215.                 $result .= $this->LE.$this->LE;
    1216.  
    1217.                 $result .= $this->EndBoundary($this->boundary[2]);
    1218.                
    1219.                 $result .= $this->AttachAll();
    1220.                 break;
    1221.         }
    1222.         if($this->IsError())
    1223.             $result = "";
    1224.  
    1225.         return $result;
    1226.     }
    1227.  
    1228.     /**
    1229.      * Returns the start of a message boundary.
    1230.      * @access private
    1231.      */
    1232.     function GetBoundary($boundary, $charSet, $contentType, $encoding) {
    1233.         $result = "";
    1234.         if($charSet == "") { $charSet = $this->CharSet; }
    1235.         if($contentType == "") { $contentType = $this->ContentType; }
    1236.         if($encoding == "") { $encoding = $this->Encoding; }
    1237.  
    1238.         $result .= $this->TextLine("--" . $boundary);
    1239.         $result .= sprintf("Content-Type: %s; charset = \"%s\"",
    1240.                             $contentType, $charSet);
    1241.         $result .= $this->LE;
    1242.         $result .= $this->HeaderLine("Content-Transfer-Encoding", $encoding);
    1243.         $result .= $this->LE;
    1244.        
    1245.         return $result;
    1246.     }
    1247.    
    1248.     /**
    1249.      * Returns the end of a message boundary.
    1250.      * @access private
    1251.      */
    1252.     function EndBoundary($boundary) {
    1253.         return $this->LE . "--" . $boundary . "--" . $this->LE;
    1254.     }
    1255.    
    1256.     /**
    1257.      * Sets the message type.
    1258.      * @access private
    1259.      * @return void
    1260.      */
    1261.     function SetMessageType() {
    1262.         if(count($this->attachment) < 1 && strlen($this->AltBody) < 1)
    1263.             $this->message_type = "plain";
    1264.         else
    1265.         {
    1266.             if(count($this->attachment) > 0)
    1267.                 $this->message_type = "attachments";
    1268.             if(strlen($this->AltBody) > 0 && count($this->attachment) < 1)
    1269.                 $this->message_type = "alt";
    1270.             if(strlen($this->AltBody) > 0 && count($this->attachment) > 0)
    1271.                 $this->message_type = "alt_attachments";
    1272.         }
    1273.     }
    1274.  
    1275.     /**
    1276.      * Returns a formatted header line.
    1277.      * @access private
    1278.      * @return string
    1279.      */
    1280.     function HeaderLine($name, $value) {
    1281.         return $name . ": " . $value . $this->LE;
    1282.     }
    1283.  
    1284.     /**
    1285.      * Returns a formatted mail line.
    1286.      * @access private
    1287.      * @return string
    1288.      */
    1289.     function TextLine($value) {
    1290.         return $value . $this->LE;
    1291.     }
    1292.  
    1293.     /////////////////////////////////////////////////
    1294.     // ATTACHMENT METHODS
    1295.     /////////////////////////////////////////////////
    1296.  
    1297.     /**
    1298.      * Adds an attachment from a path on the filesystem.
    1299.      * Returns false if the file could not be found
    1300.      * or accessed.
    1301.      * @param string $path Path to the attachment.
    1302.      * @param string $name Overrides the attachment name.
    1303.      * @param string $encoding File encoding (see $Encoding).
    1304.      * @param string $type File extension (MIME) type.
    1305.      * @return bool
    1306.      */
    1307.     function AddAttachment($path, $name = "", $encoding = "base64",
    1308.                            $type = "application/octet-stream") {
    1309.         if([EMAIL="!@is_file($path"]!@is_file($path[/EMAIL]))
    1310.         {
    1311.             $this->SetError($this->Lang("file_access") . $path);
    1312.             return false;
    1313.         }
    1314.  
    1315.         $filename = basename($path);
    1316.         if($name == "")
    1317.             $name = $filename;
    1318.  
    1319.         $cur = count($this->attachment);
    1320.         $this->attachment[$cur][0] = $path;
    1321.         $this->attachment[$cur][1] = $filename;
    1322.         $this->attachment[$cur][2] = $name;
    1323.         $this->attachment[$cur][3] = $encoding;
    1324.         $this->attachment[$cur][4] = $type;
    1325.         $this->attachment[$cur][5] = false; // isStringAttachment
    1326.         $this->attachment[$cur][6] = "attachment";
    1327.         $this->attachment[$cur][7] = 0;
    1328.  
    1329.         return true;
    1330.     }
    1331.  
    1332.     /**
    1333.      * Attaches all fs, string, and binary attachments to the message.
    1334.      * Returns an empty string on failure.
    1335.      * @access private
    1336.      * @return string
    1337.      */
    1338.     function AttachAll() {
    1339.         // Return text of body
    1340.         $mime = array();
    1341.  
    1342.         // Add all attachments
    1343.         for($i = 0; $i < count($this->attachment); $i++)
    1344.         {
    1345.             // Check for string attachment
    1346.             $bString = $this->attachment[$i][5];
    1347.             if ($bString)
    1348.                 $string = $this->attachment[$i][0];
    1349.             else
    1350.                 $path = $this->attachment[$i][0];
    1351.  
    1352.             $filename    = $this->attachment[$i][1];
    1353.             $name        = $this->attachment[$i][2];
    1354.             $encoding    = $this->attachment[$i][3];
    1355.             $type        = $this->attachment[$i][4];
    1356.             $disposition = $this->attachment[$i][6];
    1357.             $cid         = $this->attachment[$i][7];
    1358.            
    1359.             $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
    1360.             $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE);
    1361.             $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
    1362.  
    1363.             if($disposition == "inline")
    1364.                 $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
    1365.  
    1366.             $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s",
    1367.                               $disposition, $name, $this->LE.$this->LE);
    1368.  
    1369.             // Encode as string attachment
    1370.             if($bString)
    1371.             {
    1372.                 $mime[] = $this->EncodeString($string, $encoding);
    1373.                 if($this->IsError()) { return ""; }
    1374.                 $mime[] = $this->LE.$this->LE;
    1375.             }
    1376.             else
    1377.             {
    1378.                 $mime[] = $this->EncodeFile($path, $encoding);                
    1379.                 if($this->IsError()) { return ""; }
    1380.                 $mime[] = $this->LE.$this->LE;
    1381.             }
    1382.         }
    1383.  
    1384.         $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE);
    1385.  
    1386.         return join("", $mime);
    1387.     }
    1388.    
    1389.     /**
    1390.      * Encodes attachment in requested format.  Returns an
    1391.      * empty string on failure.
    1392.      * @access private
    1393.      * @return string
    1394.      */
    1395.     function EncodeFile ($path, $encoding = "base64") {
    1396.         if([EMAIL="!@$fd"]!@$fd[/EMAIL] = fopen($path, "rb"))
    1397.         {
    1398.             $this->SetError($this->Lang("file_open") . $path);
    1399.             return "";
    1400.         }
    1401.         $file_buffer = fread($fd, filesize($path));
    1402.         $file_buffer = $this->EncodeString($file_buffer, $encoding);
    1403.         fclose($fd);
    1404.  
    1405.         return $file_buffer;
    1406.     }
    1407.  
    1408.     /**
    1409.      * Encodes string to requested format. Returns an
    1410.      * empty string on failure.
    1411.      * @access private
    1412.      * @return string
    1413.      */
    1414.     function EncodeString ($str, $encoding = "base64") {
    1415.         $encoded = "";
    1416.         switch(strtolower($encoding)) {
    1417.           case "base64":
    1418.               // chunk_split is found in PHP >= 3.0.6
    1419.               $encoded = chunk_split(base64_encode($str), 76, $this->LE);
    1420.               break;
    1421.           case "7bit":
    1422.           case "8bit":
    1423.               $encoded = $this->FixEOL($str);
    1424.               if (substr($encoded, -(strlen($this->LE))) != $this->LE)
    1425.                 $encoded .= $this->LE;
    1426.               break;
    1427.           case "binary":
    1428.               $encoded = $str;
    1429.               break;
    1430.           case "quoted-printable":
    1431.               $encoded = $this->EncodeQP($str);
    1432.               break;
    1433.           default:
    1434.               $this->SetError($this->Lang("encoding") . $encoding);
    1435.               break;
    1436.         }
    1437.         return $encoded;
    1438.     }
    1439.  
    1440.     /**
    1441.      * Encode a header string to best of Q, B, quoted or none.  
    1442.      * @access private
    1443.      * @return string
    1444.      */
    1445.     function EncodeHeader ($str, $position = 'text') {
    1446.       $x = 0;
    1447.      
    1448.       switch (strtolower($position)) {
    1449.         case 'phrase':
    1450.           if (!preg_match('/[\200-\377]/', $str)) {
    1451.             // Can't use addslashes as we don't know what value has magic_quotes_sybase.
    1452.             $encoded = ad***lashes($str, "\0..\37\177\\\"");
    1453.  
    1454.             if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str))
    1455.               return ($encoded);
    1456.             else
    1457.               return ("\"$encoded\"");
    1458.           }
    1459.           $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
    1460.           break;
    1461.         case 'comment':
    1462.           $x = preg_match_all('/[()"]/', $str, $matches);
    1463.           // Fall-through
    1464.         case 'text':
    1465.         default:
    1466.           $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
    1467.           break;
    1468.       }
    1469.  
    1470.       if ($x == 0)
    1471.         return ($str);
    1472.  
    1473.       $maxlen = 75 - 7 - strlen($this->CharSet);
    1474.       // Try to select the encoding which should produce the shortest output
    1475.       if (strlen($str)/3 < $x) {
    1476.         $encoding = 'B';
    1477.         $encoded = base64_encode($str);
    1478.         $maxlen -= $maxlen % 4;
    1479.         $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
    1480.       } else {
    1481.         $encoding = 'Q';
    1482.         $encoded = $this->EncodeQ($str, $position);
    1483.         $encoded = $this->WrapText($encoded, $maxlen, true);
    1484.         $encoded = str_replace("=".$this->LE, "\n", trim($encoded));
    1485.       }
    1486.  
    1487.       $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded);
    1488.       $encoded = trim(str_replace("\n", $this->LE, $encoded));
    1489.      
    1490.       return $encoded;
    1491.     }
    1492.    
    1493.     /**
    1494.      * Encode string to quoted-printable.  
    1495.      * @access private
    1496.      * @return string
    1497.      */
    1498.     function EncodeQP ($str) {
    1499.         $encoded = $this->FixEOL($str);
    1500.         if (substr($encoded, -(strlen($this->LE))) != $this->LE)
    1501.             $encoded .= $this->LE;
    1502.  
    1503.         // Replace every high ascii, control and = characters
    1504.         $encoded = preg_replace('/([\000-\010\013\014\016-\037\075\177-\377])/e',
    1505.                   "'='.sprintf('%02X', ord('\\1'))", $encoded);
    1506.         // Replace every spaces and tabs when it's the last character on a line
    1507.         $encoded = preg_replace("/([\011\040])".$this->LE."/e",
    1508.                   "'='.sprintf('%02X', ord('\\1')).'".$this->LE."'", $encoded);
    1509.  
    1510.         // Maximum line length of 76 characters before CRLF (74 + space + '=')
    1511.         $encoded = $this->WrapText($encoded, 74, true);
    1512.  
    1513.         return $encoded;
    1514.     }
    1515.  
    1516.     /**
    1517.      * Encode string to q encoding.  
    1518.      * @access private
    1519.      * @return string
    1520.      */
    1521.     function EncodeQ ($str, $position = "text") {
    1522.         // There should not be any EOL in the string
    1523.         $encoded = preg_replace("[\r\n]", "", $str);
    1524.  
    1525.         switch (strtolower($position)) {
    1526.           case "phrase":
    1527.             $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
    1528.             break;
    1529.           case "comment":
    1530.             $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
    1531.           case "text":
    1532.           default:
    1533.             // Replace every high ascii, control =, ? and _ characters
    1534.             $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',
    1535.                   "'='.sprintf('%02X', ord('\\1'))", $encoded);
    1536.             break;
    1537.         }
    1538.        
    1539.         // Replace every spaces to _ (more readable than =20)
    1540.         $encoded = str_replace(" ", "_", $encoded);
    1541.  
    1542.         return $encoded;
    1543.     }
    1544.  
    1545.     /**
    1546.      * Adds a string or binary attachment (non-filesystem) to the list.
    1547.      * This method can be used to attach ascii or binary data,
    1548.      * such as a BLOB record from a database.
    1549.      * @param string $string String attachment data.
    1550.      * @param string $filename Name of the attachment.
    1551.      * @param string $encoding File encoding (see $Encoding).
    1552.      * @param string $type File extension (MIME) type.
    1553.      * @return void
    1554.      */
    1555.     function AddStringAttachment($string, $filename, $encoding = "base64",
    1556.                                  $type = "application/octet-stream") {
    1557.         // Append to $attachment array
    1558.         $cur = count($this->attachment);
    1559.         $this->attachment[$cur][0] = $string;
    1560.         $this->attachment[$cur][1] = $filename;
    1561.         $this->attachment[$cur][2] = $filename;
    1562.         $this->attachment[$cur][3] = $encoding;
    1563.         $this->attachment[$cur][4] = $type;
    1564.         $this->attachment[$cur][5] = true; // isString
    1565.         $this->attachment[$cur][6] = "attachment";
    1566.         $this->attachment[$cur][7] = 0;
    1567.     }
    1568.    
    1569.     /**
    1570.      * Adds an embedded attachment.  This can include images, sounds, and
    1571.      * just about any other document.  Make sure to set the $type to an
    1572.      * image type.  For JPEG images use "image/jpeg" and for GIF images
    1573.      * use "image/gif".
    1574.      * @param string $path Path to the attachment.
    1575.      * @param string $cid Content ID of the attachment.  Use this to identify
    1576.      *        the Id for accessing the image in an HTML form.
    1577.      * @param string $name Overrides the attachment name.
    1578.      * @param string $encoding File encoding (see $Encoding).
    1579.      * @param string $type File extension (MIME) type.  
    1580.      * @return bool
    1581.      */
    1582.     function AddEmbeddedImage($path, $cid, $name = "", $encoding = "base64",
    1583.                               $type = "application/octet-stream") {
    1584.    
    1585.         if([EMAIL="!@is_file($path"]!@is_file($path[/EMAIL]))
    1586.         {
    1587.             $this->SetError($this->Lang("file_access") . $path);
    1588.             return false;
    1589.         }
    1590.  
    1591.         $filename = basename($path);
    1592.         if($name == "")
    1593.             $name = $filename;
    1594.  
    1595.         // Append to $attachment array
    1596.         $cur = count($this->attachment);
    1597.         $this->attachment[$cur][0] = $path;
    1598.         $this->attachment[$cur][1] = $filename;
    1599.         $this->attachment[$cur][2] = $name;
    1600.         $this->attachment[$cur][3] = $encoding;
    1601.         $this->attachment[$cur][4] = $type;
    1602.         $this->attachment[$cur][5] = false; // isStringAttachment
    1603.         $this->attachment[$cur][6] = "inline";
    1604.         $this->attachment[$cur][7] = $cid;
    1605.    
    1606.         return true;
    1607.     }
    1608.    
    1609.     /**
    1610.      * Returns true if an inline attachment is present.
    1611.      * @access private
    1612.      * @return bool
    1613.      */
    1614.     function InlineImageExists() {
    1615.         $result = false;
    1616.         for($i = 0; $i < count($this->attachment); $i++)
    1617.         {
    1618.             if($this->attachment[$i][6] == "inline")
    1619.             {
    1620.                 $result = true;
    1621.                 break;
    1622.             }
    1623.         }
    1624.        
    1625.         return $result;
    1626.     }
    1627.  
    1628.     /////////////////////////////////////////////////
    1629.     // MESSAGE RESET METHODS
    1630.     /////////////////////////////////////////////////
    1631.  
    1632.     /**
    1633.      * Clears all recipients assigned in the TO array.  Returns void.
    1634.      * @return void
    1635.      */
    1636.     function ClearAddresses() {
    1637.         $this->to = array();
    1638.     }
    1639.  
    1640.     /**
    1641.      * Clears all recipients assigned in the CC array.  Returns void.
    1642.      * @return void
    1643.      */
    1644.     function ClearCCs() {
    1645.         $this->cc = array();
    1646.     }
    1647.  
    1648.     /**
    1649.      * Clears all recipients assigned in the BCC array.  Returns void.
    1650.      * @return void
    1651.      */
    1652.     function ClearBCCs() {
    1653.         $this->bcc = array();
    1654.     }
    1655.  
    1656.     /**
    1657.      * Clears all recipients assigned in the ReplyTo array.  Returns void.
    1658.      * @return void
    1659.      */
    1660.     function ClearReplyTos() {
    1661.         $this->ReplyTo = array();
    1662.     }
    1663.  
    1664.     /**
    1665.      * Clears all recipients assigned in the TO, CC and BCC
    1666.      * array.  Returns void.
    1667.      * @return void
    1668.      */
    1669.     function ClearAllRecipients() {
    1670.         $this->to = array();
    1671.         $this->cc = array();
    1672.         $this->bcc = array();
    1673.     }
    1674.  
    1675.     /**
    1676.      * Clears all previously set filesystem, string, and binary
    1677.      * attachments.  Returns void.
    1678.      * @return void
    1679.      */
    1680.     function ClearAttachments() {
    1681.         $this->attachment = array();
    1682.     }
    1683.  
    1684.     /**
    1685.      * Clears all custom headers.  Returns void.
    1686.      * @return void
    1687.      */
    1688.     function ClearCustomHeaders() {
    1689.         $this->CustomHeader = array();
    1690.     }
    1691.  
    1692.  
    1693.     /////////////////////////////////////////////////
    1694.     // MISCELLANEOUS METHODS
    1695.     /////////////////////////////////////////////////
    1696.  
    1697.     /**
    1698.      * Adds the error message to the error container.
    1699.      * Returns void.
    1700.      * @access private
    1701.      * @return void
    1702.      */
    1703.     function SetError($msg) {
    1704.         $this->error_count++;
    1705.         $this->ErrorInfo = $msg;
    1706.     }
    1707.  
    1708.     /**
    1709.      * Returns the proper RFC 822 formatted date.
    1710.      * @access private
    1711.      * @return string
    1712.      */
    1713.     function RFCDate() {
    1714.         $tz = date("Z");
    1715.         $tzs = ($tz < 0) ? "-" : "+";
    1716.         $tz = abs($tz);
    1717.         $tz = ($tz/3600)*100 + ($tz%3600)/60;
    1718.         $result = sprintf("%s %s%04d", date("D, j M Y H:i:s"), $tzs, $tz);
    1719.  
    1720.         return $result;
    1721.     }
    1722.    
    1723.     /**
    1724.      * Returns the appropriate server variable.  Should work with both
    1725.      * PHP 4.1.0+ as well as older versions.  Returns an empty string
    1726.      * if nothing is found.
    1727.      * @access private
    1728.      * @return mixed
    1729.      */
    1730.     function ServerVar($varName) {
    1731.         global $HTTP_SERVER_VARS;
    1732.         global $HTTP_ENV_VARS;
    1733.  
    1734.         if(!isset($_SERVER))
    1735.         {
    1736.             $_SERVER = $HTTP_SERVER_VARS;
    1737.             if(!isset($_SERVER["REMOTE_ADDR"]))
    1738.                 $_SERVER = $HTTP_ENV_VARS; // must be Apache
    1739.         }
    1740.        
    1741.         if(isset($_SERVER[$varName]))
    1742.             return $_SERVER[$varName];
    1743.         else
    1744.             return "";
    1745.     }
    1746.  
    1747.     /**
    1748.      * Returns the server hostname or 'localhost.localdomain' if unknown.
    1749.      * @access private
    1750.      * @return string
    1751.      */
    1752.     function ServerHostname() {
    1753.         if ($this->Hostname != "")
    1754.             $result = $this->Hostname;
    1755.         elseif ($this->ServerVar('SERVER_NAME') != "")
    1756.             $result = $this->ServerVar('SERVER_NAME');
    1757.         else
    1758.             $result = "localhost.localdomain";
    1759.  
    1760.         return $result;
    1761.     }
    1762.  
    1763.     /**
    1764.      * Returns a message in the appropriate language.
    1765.      * @access private
    1766.      * @return string
    1767.      */
    1768.     function Lang($key) {
    1769.         if(count($this->language) < 1)
    1770.             $this->SetLanguage("en"); // set the default language
    1771.    
    1772.         if(isset($this->language[$key]))
    1773.             return $this->language[$key];
    1774.         else
    1775.             return "Language string failed to load: " . $key;
    1776.     }
    1777.    
    1778.     /**
    1779.      * Returns true if an error occurred.
    1780.      * @return bool
    1781.      */
    1782.     function IsError() {
    1783.         return ($this->error_count > 0);
    1784.     }
    1785.  
    1786.     /**
    1787.      * Changes every end of line from CR or LF to CRLF.  
    1788.      * @access private
    1789.      * @return string
    1790.      */
    1791.     function FixEOL($str) {
    1792.         $str = str_replace("\r\n", "\n", $str);
    1793.         $str = str_replace("\r", "\n", $str);
    1794.         $str = str_replace("\n", $this->LE, $str);
    1795.         return $str;
    1796.     }
    1797.  
    1798.     /**
    1799.      * Adds a custom header.
    1800.      * @return void
    1801.      */
    1802.     function AddCustomHeader($custom_header) {
    1803.         $this->CustomHeader[] = explode(":", $custom_header, 2);
    1804.     }
    1805. }
    1806.  
    1807. ?>
    1808.  
    Danke schon mal
     
    Zuletzt von einem Moderator bearbeitet: 21.07.2008
    #5      
  6. MasterJoko

    MasterJoko Erklärbär

    Dabei seit:
    12.02.2006
    Beiträge:
    111
    Geschlecht:
    männlich
    Software:
    CS3 Suite
    Kameratyp:
    Sony DSC P52
    Kontakt Formular funktioniert nicht
    AW: Kontakt Formular funktioniert nicht

    Hi ho...

    ---------- suche nach -----------------

    var $From = "root@localhost";

    ---------------------------------------

    abändern durch deine email adresse

    dann folgende zeilen noch abändern:

    zeile 205 - 315 durchgehen, und prüfen...

    habs eben nur überflogen - aber den phpmailer musst du schon noch konfigurieren... :)

    also ab

    mfg
     
    #6      
  7. AchimPf

    AchimPf Aktives Mitglied

    Dabei seit:
    08.11.2007
    Beiträge:
    258
    Geschlecht:
    männlich
    Ort:
    Trier
    Software:
    Photoshop CS4, Illustrator CS4, Flash CS4, Dreamweaver CS4
    Kontakt Formular funktioniert nicht
    AW: Kontakt Formular funktioniert nicht

    OK Danke,
    werds mal versuchen

    Danke auf jeden Fall
     
    #7      
Die Seite wird geladen...
© 2002 - 2016 PSD-Tutorials.de – ein Projekt mit der 4eck Media GmbH & Co. KG
x
×
×