Public Member Functions | |
| start () | |
| useBase64 () | |
| [Describe function...] | |
| encodeMsg ($content) | |
| [Describe function...] | |
| addPlain ($content) | |
| [Describe function...] | |
| addAttachment ($file) | |
| [Describe function...] | |
| addHTML ($file) | |
| [Describe function...] | |
| extractHtmlInit ($html, $url) | |
| External used to extract HTML-parts. | |
| send ($recipient) | |
| [Describe function...] | |
| setHeaders () | |
| setRecipient ($recip) | |
| [Describe function...] | |
| getHTMLContentType () | |
| [Describe function...] | |
| setContent () | |
| [Describe function...] | |
| constructMixed ($boundary) | |
| [Describe function...] | |
| constructHTML ($boundary) | |
| [Describe function...] | |
| constructAlternative ($boundary) | |
| [Describe function...] | |
| constructHTML_media ($boundary) | |
| [Describe function...] | |
| sendTheMail () | |
| [Describe function...] | |
| getBoundary () | |
| [Describe function...] | |
| setPlain ($content) | |
| [Describe function...] | |
| setHtml ($content) | |
| [Describe function...] | |
| add_header ($header) | |
| [Describe function...] | |
| add_message ($string) | |
| [Describe function...] | |
| getContent ($type) | |
| [Describe function...] | |
| preview () | |
| [Describe function...] | |
| fetchHTML ($file) | |
| fetchHTMLMedia () | |
| [Describe function...] | |
| extractMediaLinks () | |
| [Describe function...] | |
| extractHyperLinks () | |
| [Describe function...] | |
| extractFramesInfo () | |
| [Describe function...] | |
| substMediaNamesInHTML ($absolute) | |
| [Describe function...] | |
| substHREFsInHTML () | |
| [Describe function...] | |
| substHTTPurlsInPlainText ($content) | |
| [Describe function...] | |
| fixRollOvers () | |
| [Describe function...] | |
| makeBase64 ($inputstr) | |
| getExtendedURL ($url) | |
| [Describe function...] | |
| addUserPass ($url) | |
| [Describe function...] | |
| getURL ($url) | |
| [Describe function...] | |
| getStrippedURL ($url) | |
| [Describe function...] | |
| getMimeType ($url) | |
| [Describe function...] | |
| absRef ($ref) | |
| [Describe function...] | |
| split_fileref ($fileref) | |
| [Describe function...] | |
| extParseUrl ($path) | |
| [Describe function...] | |
| tag_regex ($tagArray) | |
| [Describe function...] | |
| get_tag_attributes ($tag) | |
| analyses a HTML-tag $tag is either like this "<TAG OPTION ATTRIB=VALUE>" or this " OPTION ATTRIB=VALUE>" which means you can omit the tag-name returns an array with the attributes as keys in lower-case If an attribute is empty (like OPTION) the value of that key is just empty. | |
| quoted_printable ($string) | |
| [Describe function...] | |
| convertName ($name) | |
| [Describe function...] | |
Public Attributes | |
| $recipient = "recipient@whatever.com" | |
| $recipient_copy = "" | |
| $subject = "This is the subject" | |
| $from_email = "sender@php-mailer.com" | |
| $from_name = "Mr. Sender" | |
| $replyto_email = "reply@mailer.com" | |
| $replyto_name = "Mr. Reply" | |
| $organisation = "Your Company" | |
| $priority = 3 | |
| $mailer = "PHP mailer" | |
| $alt_base64 = 0 | |
| $jumperURL_prefix = "" | |
| $jumperURL_useId = 0 | |
| $mediaList = "" | |
| $http_password = "" | |
| $http_username = "" | |
| $theParts = Array() | |
| $messageid = "" | |
| $returnPath = "" | |
| $Xid = "" | |
| $headers = "" | |
| $message = "" | |
| $part = 0 | |
| $image_fullpath_list = "" | |
| $href_fullpath_list = "" | |
| $plain_text_header = "Content-Type: text/plain; charset=iso-8859-1\nContent-Transfer-Encoding: quoted-printable" | |
| $html_text_header = "Content-Type: text/html; charset=iso-8859-1\nContent-Transfer-Encoding: quoted-printable" | |
| return | $attributes |
|
|
[Describe function...]
Definition at line 1206 of file class.t3lib_htmlmail.php. 01206 {
01207 // Returns the absolute address of a link. This is based on $this->theParts["html"]["path"] being the root-address
01208 $ref = trim($ref);
01209 $urlINFO = parse_url($ref);
01210 if ($urlINFO["scheme"]) {
01211 return $ref;
01212 } elseif (eregi("^/",$ref)){
01213 $addr = parse_url($this->theParts["html"]["path"]);
01214 return $addr["scheme"]."://".$addr["host"].$ref;
01215 } else {
01216 return $this->theParts["html"]["path"].$ref; // If the reference is relative, the path is added, in order for us to fetch the content
01217 }
01218 }
|
|
|
[Describe function...]
Definition at line 698 of file class.t3lib_htmlmail.php. Referenced by setHeaders(). 00698 {
00699 // Adds a header to the mail. Use this AFTER the setHeaders()-function
00700 $this->headers.=$header."\n";
00701 }
|
|
|
[Describe function...]
Definition at line 709 of file class.t3lib_htmlmail.php. References message(). 00709 {
00710 // Adds a line of text to the mail-body. Is normally use internally
00711 $this->message.=$string."\n";
00712 }
|
|
|
[Describe function...]
Definition at line 297 of file class.t3lib_htmlmail.php. References getExtendedURL(), and split_fileref(). 00297 {
00298 // Adds an attachment to the mail
00299 $theArr = $this->getExtendedURL($file); // We fetch the content and the mime-type
00300 if ($theArr) {
00301 if (!$theArr["content_type"]){$theArr["content_type"]="application/octet-stream";}
00302 $temp = $this->split_fileref($file);
00303 $theArr["filename"]= (($temp["file"])?$temp["file"]:(strpos(" ".$theArr["content_type"],"htm")?"index.html":"unknown"));
00304 $this->theParts["attach"][]=$theArr;
00305 return true;
00306 } else { return false;}
00307 }
|
|
|
[Describe function...]
Definition at line 315 of file class.t3lib_htmlmail.php. References extractFramesInfo(), extractHyperLinks(), extractMediaLinks(), fetchHTML(), fetchHTMLMedia(), substHREFsInHTML(), and substMediaNamesInHTML(). 00315 {
00316 // Adds HTML and media, encodes it from a URL or file
00317 $status = $this->fetchHTML($file);
00318 // debug(md5($status));
00319 if (!$status) {return false;}
00320 if ($this->extractFramesInfo()) {
00321 return "Document was a frameset. Stopped";
00322 }
00323 $this->extractMediaLinks();
00324 $this->extractHyperLinks();
00325 $this->fetchHTMLMedia();
00326 $this->substMediaNamesInHTML(0); // 0 = relative
00327 $this->substHREFsInHTML();
00328 $this->setHTML($this->encodeMsg($this->theParts["html"]["content"]));
00329 }
|
|
|
[Describe function...]
Definition at line 285 of file class.t3lib_htmlmail.php. References $content, setPlain(), and substHTTPurlsInPlainText(). Referenced by t3lib_formmail::start(). 00285 {
00286 // Adds plain-text and qp-encodes it
00287 $content=$this->substHTTPurlsInPlainText($content);
00288 $this->setPlain($this->encodeMsg($content));
00289 }
|
|
|
[Describe function...]
Definition at line 1120 of file class.t3lib_htmlmail.php. 01120 {
01121 $user=$this->http_username;
01122 $pass=$this->http_password;
01123 if ($user && $pass && substr($url,0,7)=="http://") {
01124 $url = "http://".$user.":".$pass."@".substr($url,7);
01125 }
01126 return $url;
01127 }
|
|
|
[Describe function...]
Definition at line 548 of file class.t3lib_htmlmail.php. 00548 {
00549 // Here plain is combined with HTML
00550 $this->add_message("--".$boundary);
00551 // plain is added
00552 $this->add_message($this->plain_text_header);
00553 $this->add_message('');
00554 $this->add_message($this->getContent("plain"));
00555 $this->add_message("--".$boundary);
00556 // html is added
00557 $this->add_message($this->html_text_header);
00558 $this->add_message('');
00559 $this->add_message($this->getContent("html"));
00560 $this->add_message("--".$boundary."--\n");
00561 }
|
|
|
[Describe function...]
Definition at line 525 of file class.t3lib_htmlmail.php. 00525 {
00526 if (count($this->theParts["html"]["media"])) { // If media, then we know, the multipart/related content-type has been set before this function call...
00527 $this->add_message("--".$boundary);
00528 // HTML has media
00529 $newBoundary = $this->getBoundary();
00530 $this->add_message("Content-Type: multipart/alternative;");
00531 $this->add_message(' boundary="'.$newBoundary.'"');
00532 $this->add_message('');
00533
00534 $this->constructAlternative($newBoundary); // Adding the plaintext/html mix
00535
00536 $this->constructHTML_media($boundary);
00537 } else {
00538 $this->constructAlternative($boundary); // Adding the plaintext/html mix, and if no media, then use $boundary instead of $newBoundary
00539 }
00540 }
|
|
|
[Describe function...]
Definition at line 569 of file class.t3lib_htmlmail.php. 00569 {
00570 /* // Constructs the HTML-part of message if the HTML contains media
00571 $this->add_message("--".$boundary);
00572 // htmlcode is added
00573 $this->add_message($this->html_text_header);
00574 $this->add_message('');
00575 $this->add_message($this->getContent("html"));
00576
00577 OLD stuf...
00578
00579 */
00580 // media is added
00581 if (is_array($this->theParts["html"]["media"])) {
00582 reset($this->theParts["html"]["media"]);
00583 while(list($key,$media)=each($this->theParts["html"]["media"])) {
00584 if (!$this->mediaList || t3lib_div::inList($this->mediaList,$key)) {
00585 $this->add_message("--".$boundary);
00586 $this->add_message("Content-Type: ".$media["ctype"]);
00587 $this->add_message("Content-ID: <part".$key.".".$this->messageid.">");
00588 $this->add_message("Content-Transfer-Encoding: base64");
00589 $this->add_message('');
00590 $this->add_message($this->makeBase64($media["content"]));
00591 }
00592 }
00593 }
00594 $this->add_message("--".$boundary."--\n");
00595 }
|
|
|
[Describe function...]
Definition at line 486 of file class.t3lib_htmlmail.php. 00486 {
00487 // Here (plain/HTML) is combined with the attachments
00488 $this->add_message("--".$boundary);
00489 // (plain/HTML) is added
00490 if ($this->theParts["html"]["content"]) {
00491 // HTML and plain
00492 $newBoundary = $this->getBoundary();
00493 $this->add_message("Content-Type: ".$this->getHTMLContentType());
00494 $this->add_message(' boundary="'.$newBoundary.'"');
00495 $this->add_message('');
00496 $this->constructHTML($newBoundary);
00497 } else { // Purely plain
00498 $this->add_message($this->plain_text_header);
00499 $this->add_message('');
00500 $this->add_message($this->getContent("plain"));
00501 }
00502 // attachments are added
00503 if (is_array($this->theParts["attach"])) {
00504 reset($this->theParts["attach"]);
00505 while(list(,$media)=each($this->theParts["attach"])) {
00506 $this->add_message("--".$boundary);
00507 $this->add_message("Content-Type: ".$media["content_type"]);
00508 $this->add_message(' name="'.$media["filename"].'"');
00509 $this->add_message("Content-Transfer-Encoding: base64");
00510 $this->add_message("Content-Disposition: attachment;");
00511 $this->add_message(' filename="'.$media["filename"].'"');
00512 $this->add_message('');
00513 $this->add_message($this->makeBase64($media["content"]));
00514 }
00515 }
00516 $this->add_message("--".$boundary."--\n");
00517 }
|
|
|
[Describe function...]
Definition at line 1368 of file class.t3lib_htmlmail.php. 01368 {
01369 if (ereg("[^".chr(32)."-".chr(60).chr(62)."-".chr(127)."]",$name)) {
01370 return '=?iso-8859-1?B?'.base64_encode($name).'?=';
01371 } else {
01372 return $name;
01373 }
01374 }
|
|
|
[Describe function...]
Definition at line 275 of file class.t3lib_htmlmail.php. References makeBase64(), and quoted_printable(). Referenced by t3lib_dmailer::dmailer_sendAdvanced(), and t3lib_dmailer::dmailer_sendSimple(). 00275 {
00276 return $this->alt_base64 ? $this->makeBase64($content) : $this->quoted_printable($content);
00277 }
|
|
|
[Describe function...]
Definition at line 1253 of file class.t3lib_htmlmail.php. 01253 {
01254 // Returns an array with file or url-information
01255 $res = parse_url($path);
01256 ereg("(.*/)([^/]*)$",$res["path"],$reg);
01257 $res["filepath"]=$reg[1];
01258 $res["filename"]=$reg[2];
01259 return $res;
01260 }
|
|
|
[Describe function...]
Definition at line 921 of file class.t3lib_htmlmail.php. Referenced by addHTML(). 00921 {
00922 // extracts all media-links from $this->theParts["html"]["content"]
00923 $html_code = $this->theParts["html"]["content"];
00924 if (strpos(" ".$html_code,"<frame ")) {
00925 $attribRegex = $this->tag_regex("frame");
00926 $codepieces = split($attribRegex, $html_code, 1000000 ); // Splits the document by the beginning of the above tags
00927 $pieces = count($codepieces);
00928 for($i=1; $i < $pieces; $i++) {
00929 $dummy = eregi("[^>]*", $codepieces[$i], $reg);
00930 $attributes = $this->get_tag_attributes($reg[0]); // Fetches the attributes for the tag
00931 $frame="";
00932 $frame["src"]=$attributes["src"];
00933 $frame["name"]=$attributes["name"];
00934 $frame["absRef"] = $this->absRef($frame["src"]);
00935 $theInfo[] = $frame;
00936 }
00937 return $theInfo;
00938 }
00939 }
|
|
||||||||||||
|
External used to extract HTML-parts.
Definition at line 338 of file class.t3lib_htmlmail.php. 00338 {
00339 $this->theParts["html"]["content"]=$html;
00340 $this->theParts["html"]["path"]=$url;
00341 }
|
|
|
[Describe function...]
Definition at line 872 of file class.t3lib_htmlmail.php. Referenced by addHTML(). 00872 {
00873 // extracts all hyper-links from $this->theParts["html"]["content"]
00874 $html_code = $this->theParts["html"]["content"];
00875 $attribRegex = $this->tag_regex(Array("a","form","area"));
00876 $codepieces = split($attribRegex, $html_code); // Splits the document by the beginning of the above tags
00877 $len=strlen($codepieces[0]);
00878 $pieces = count($codepieces);
00879 for($i=1; $i < $pieces; $i++) {
00880 $tag = strtolower(strtok(substr($html_code,$len+1,10)," "));
00881 $len+=strlen($tag)+strlen($codepieces[$i])+2;
00882
00883 $dummy = eregi("[^>]*", $codepieces[$i], $reg);
00884 $attributes = $this->get_tag_attributes($reg[0]); // Fetches the attributes for the tag
00885 $hrefData="";
00886 if ($attributes["href"]) {$hrefData["ref"]=$attributes["href"];} else {$hrefData["ref"]=$attributes["action"];}
00887 if ($hrefData["ref"]) {
00888 $hrefData["quotes"]=(substr($codepieces[$i],strpos($codepieces[$i], $hrefData["ref"])-1,1)=='"')?'"':''; // Finds out if the value had quotes around it
00889 $hrefData["subst_str"] = $hrefData["quotes"].$hrefData["ref"].$hrefData["quotes"]; // subst_str is the string to look for, when substituting lateron
00890 if ($hrefData["ref"] && substr(trim($hrefData["ref"]),0,1)!="#" && !strstr($this->href_fullpath_list,"|".$hrefData["subst_str"]."|")) {
00891 $this->href_fullpath_list.="|".$hrefData["subst_str"]."|";
00892 $hrefData["absRef"] = $this->absRef($hrefData["ref"]);
00893 $hrefData["tag"]=$tag;
00894 $this->theParts["html"]["hrefs"][]=$hrefData;
00895 }
00896 }
00897 }
00898 // Extracts TYPO3 specific links made by the openPic() JS function
00899 $codepieces = explode("onClick=\"openPic('", $html_code);
00900 $pieces = count($codepieces);
00901 for($i=1; $i < $pieces; $i++) {
00902 $showpic_linkArr = explode("'",$codepieces[$i]);
00903 $hrefData["ref"]=$showpic_linkArr[0];
00904 if ($hrefData["ref"]) {
00905 $hrefData["quotes"]="'"; // Finds out if the value had quotes around it
00906 $hrefData["subst_str"] = $hrefData["quotes"].$hrefData["ref"].$hrefData["quotes"]; // subst_str is the string to look for, when substituting lateron
00907 if ($hrefData["ref"] && !strstr($this->href_fullpath_list,"|".$hrefData["subst_str"]."|")) {
00908 $this->href_fullpath_list.="|".$hrefData["subst_str"]."|";
00909 $hrefData["absRef"] = $this->absRef($hrefData["ref"]);
00910 $this->theParts["html"]["hrefs"][]=$hrefData;
00911 }
00912 }
00913 }
00914 }
|
|
|
[Describe function...]
Definition at line 796 of file class.t3lib_htmlmail.php. Referenced by addHTML(). 00796 {
00797 // extracts all media-links from $this->theParts["html"]["content"]
00798 $html_code = $this->theParts["html"]["content"];
00799 $attribRegex = $this->tag_regex(Array("img","table","td","tr","body","iframe","script","input","embed"));
00800 $codepieces = split($attribRegex, $html_code); // Splits the document by the beginning of the above tags
00801 $len=strlen($codepieces[0]);
00802 $pieces = count($codepieces);
00803 for($i=1; $i < $pieces; $i++) {
00804 $tag = strtolower(strtok(substr($html_code,$len+1,10)," "));
00805 $len+=strlen($tag)+strlen($codepieces[$i])+2;
00806 $dummy = eregi("[^>]*", $codepieces[$i], $reg);
00807 $attributes = $this->get_tag_attributes($reg[0]); // Fetches the attributes for the tag
00808 $imageData=array();
00809 $imageData["ref"]=($attributes["src"]) ? $attributes["src"] : $attributes["background"]; // Finds the src or background attribute
00810 if ($imageData["ref"]) {
00811 $imageData["quotes"]=(substr($codepieces[$i],strpos($codepieces[$i], $imageData["ref"])-1,1)=='"')?'"':''; // Finds out if the value had quotes around it
00812 $imageData["subst_str"] = $imageData["quotes"].$imageData["ref"].$imageData["quotes"]; // subst_str is the string to look for, when substituting lateron
00813 if ($imageData["ref"] && !strstr($this->image_fullpath_list,"|".$imageData["subst_str"]."|")) {
00814 $this->image_fullpath_list.="|".$imageData["subst_str"]."|";
00815 $imageData["absRef"] = $this->absRef($imageData["ref"]);
00816 $imageData["tag"]=$tag;
00817 $imageData["use_jumpurl"]=$attributes["dmailerping"]?1:0;
00818 $this->theParts["html"]["media"][]=$imageData;
00819 }
00820 }
00821 }
00822 // Extracts stylesheets
00823 $attribRegex = $this->tag_regex(Array("link"));
00824 $codepieces = split($attribRegex, $html_code); // Splits the document by the beginning of the above tags
00825 $pieces = count($codepieces);
00826 for($i=1; $i < $pieces; $i++) {
00827 $dummy = eregi("[^>]*", $codepieces[$i], $reg);
00828 $attributes = $this->get_tag_attributes($reg[0]); // Fetches the attributes for the tag
00829 $imageData=array();
00830 if (strtolower($attributes["rel"])=="stylesheet" && $attributes["href"]) {
00831 $imageData["ref"]=$attributes["href"]; // Finds the src or background attribute
00832 $imageData["quotes"]=(substr($codepieces[$i],strpos($codepieces[$i], $imageData["ref"])-1,1)=='"')?'"':''; // Finds out if the value had quotes around it
00833 $imageData["subst_str"] = $imageData["quotes"].$imageData["ref"].$imageData["quotes"]; // subst_str is the string to look for, when substituting lateron
00834 if ($imageData["ref"] && !strstr($this->image_fullpath_list,"|".$imageData["subst_str"]."|")) {
00835 $this->image_fullpath_list.="|".$imageData["subst_str"]."|";
00836 $imageData["absRef"] = $this->absRef($imageData["ref"]);
00837 $this->theParts["html"]["media"][]=$imageData;
00838 }
00839 }
00840 }
00841 // fixes javascript rollovers
00842 $codepieces = split(quotemeta(".src"), $html_code);
00843 $pieces = count($codepieces);
00844 $expr = "^[^".quotemeta("\"").quotemeta("'")."]*";
00845 for($i=1; $i < $pieces; $i++) {
00846 $temp = $codepieces[$i];
00847 $temp = trim(ereg_replace("=","",trim($temp)));
00848 ereg ($expr,substr($temp,1,strlen($temp)),$reg);
00849 $imageData["ref"] = $reg[0];
00850 $imageData["quotes"] = substr($temp,0,1);
00851 $imageData["subst_str"] = $imageData["quotes"].$imageData["ref"].$imageData["quotes"]; // subst_str is the string to look for, when substituting lateron
00852 $theInfo = $this->split_fileref($imageData["ref"]);
00853 switch ($theInfo["fileext"]) {
00854 case "gif":
00855 case "jpeg":
00856 case "jpg":
00857 if ($imageData["ref"] && !strstr($this->image_fullpath_list,"|".$imageData["subst_str"]."|")) {
00858 $this->image_fullpath_list.="|".$imageData["subst_str"]."|";
00859 $imageData["absRef"] = $this->absRef($imageData["ref"]);
00860 $this->theParts["html"]["media"][]=$imageData;
00861 }
00862 break;
00863 }
00864 }
00865 }
|
|
|
Definition at line 757 of file class.t3lib_htmlmail.php. References getURL(). Referenced by addHTML(). 00757 {
00758 // Fetches the HTML-content from either url og local serverfile
00759 $this->theParts["html"]["content"] = $this->getURL($file); // Fetches the content of the page
00760 if ($this->theParts["html"]["content"]) {
00761 $addr = $this->extParseUrl($file);
00762 $path = ($addr["scheme"]) ? $addr["scheme"]."://".$addr["host"].(($addr["filepath"])?$addr["filepath"]:"/") : $addr["filepath"];
00763 $this->theParts["html"]["path"] = $path;
00764 return true;
00765 } else {
00766 return false;
00767 }
00768 }
|
|
|
[Describe function...]
Definition at line 775 of file class.t3lib_htmlmail.php. Referenced by addHTML(). 00775 {
00776 // Fetches the mediafiles which are found by extractMediaLinks()
00777 if (is_array($this->theParts["html"]["media"])) {
00778 reset ($this->theParts["html"]["media"]);
00779 if (count($this->theParts["html"]["media"]) > 0) {
00780 while (list($key,$media) = each ($this->theParts["html"]["media"])) {
00781 $picdata = $this->getExtendedURL($this->theParts["html"]["media"][$key]["absRef"]); // We fetch the content and the mime-type
00782 if (is_array($picdata)) {
00783 $this->theParts["html"]["media"][$key]["content"] = $picdata["content"];
00784 $this->theParts["html"]["media"][$key]["ctype"] = $picdata["content_type"];
00785 }
00786 }
00787 }
00788 }
00789 }
|
|
|
[Describe function...]
Definition at line 1042 of file class.t3lib_htmlmail.php. 01042 {
01043 // JavaScript rollOvers cannot support graphics inside of mail. If these exists we must let them refer to the absolute url. By the way: Roll-overs seems to work only on some mail-readers and so far I've seen it work on Netscape 4 message-center (but not 4.5!!)
01044 $theNewContent = "";
01045 $theSplit = explode(".src",$this->theParts["html"]["content"]);
01046 if (count($theSplit)>1) {
01047 while(list($key,$part)=each($theSplit)) {
01048 $sub = substr($part,0,200);
01049 if (ereg("cid:part[^ \"']*",$sub,$reg)) {
01050 $thePos = strpos($part,$reg[0]); // The position of the string
01051 ereg("cid:part([^\.]*).*",$sub,$reg2); // Finds the id of the media...
01052 $theSubStr = $this->theParts["html"]["media"][intval($reg2[1])]["absRef"];
01053 if ($thePos && $theSubStr) { // ... and substitutes the javaScript rollover image with this instead
01054 if (!strpos(" ".$theSubStr,"http://")) {$theSubStr = "http://";} // If the path is NOT and url, the reference is set to nothing
01055 $part = substr($part,0,$thePos).$theSubStr.substr($part,$thePos+strlen($reg[0]),strlen($part));
01056 }
01057 }
01058 $theNewContent.= $part.((($key+1)!=count($theSplit))? ".src" : "" );
01059 }
01060 $this->theParts["html"]["content"]=$theNewContent;
01061 }
01062 }
|
|
|
analyses a HTML-tag $tag is either like this "<TAG OPTION ATTRIB=VALUE>" or this " OPTION ATTRIB=VALUE>" which means you can omit the tag-name returns an array with the attributes as keys in lower-case If an attribute is empty (like OPTION) the value of that key is just empty. Check it with is_set();
Definition at line 1290 of file class.t3lib_htmlmail.php. 01290 {
01291 $attributes = Array();
01292 $tag = ltrim(eregi_replace ("^<[^ ]*","",trim($tag)));
01293 $tagLen = strlen($tag);
01294 $safetyCounter = 100;
01295 // Find attribute
01296 while ($tag) {
01297 $value = "";
01298 $reg = split("[[:space:]=>]",$tag,2);
01299 $attrib = $reg[0];
01300
01301 $tag = ltrim(substr($tag,strlen($attrib),$tagLen));
01302 if (substr($tag,0,1)=="=") {
01303 $tag = ltrim(substr($tag,1,$tagLen));
01304 if (substr($tag,0,1)=='"') { // Quotes around the value
01305 $reg = explode('"',substr($tag,1,$tagLen),2);
01306 $tag = ltrim($reg[1]);
01307 $value = $reg[0];
01308 } else { // No qoutes around value
01309 ereg("^([^[:space:]>]*)(.*)",$tag,$reg);
01310 $value = trim($reg[1]);
01311 $tag = ltrim($reg[2]);
01312 if (substr($tag,0,1)==">") {
01313 $tag ="";
01314 }
01315 }
01316 }
01317 $attributes[strtolower($attrib)]=$value;
01318 $safetyCounter--;
01319 if ($safetyCounter<0) {break;}
01320 }
|
|
|
[Describe function...]
Definition at line 664 of file class.t3lib_htmlmail.php. 00664 {
00665 // Returns boundaries
00666 $this->part++;
00667 return "----------".uniqid("part_".$this->part."_");
00668 }
|
|
|
[Describe function...]
Definition at line 720 of file class.t3lib_htmlmail.php. 00720 {
00721 return $this->theParts[$type]["content"];
00722 }
|
|
|
[Describe function...]
Definition at line 1100 of file class.t3lib_htmlmail.php. References getURL(). Referenced by addAttachment(). 01100 {
01101 // reads the URL or file and determines the Content-type by either guessing or opening a connection to the host
01102 $res["content"] = $this->getURL($url);
01103 if (!$res["content"]) {return false;}
01104 $pathInfo = parse_url($url);
01105 $fileInfo = $this->split_fileref($pathInfo["path"]);
01106 if ($fileInfo["fileext"] == "gif") {$res["content_type"] = "image/gif";}
01107 if ($fileInfo["fileext"] == "jpg" || $fileInfo["fileext"] == "jpeg") {$res["content_type"] = "image/jpeg";}
01108 if ($fileInfo["fileext"] == "html" || $fileInfo["fileext"] == "htm") {$res["content_type"] = "text/html";}
01109 if ($fileInfo["fileext"] == "swf") {$res["content_type"] = "application/x-shockwave-flash";}
01110 if (!$res["content_type"]) {$res["content_type"] = $this->getMimeType($url);}
01111 return $res;
01112 }
|
|
|
[Describe function...]
Definition at line 450 of file class.t3lib_htmlmail.php. 00450 {
00451 return count($this->theParts["html"]["media"]) ? 'multipart/related;' : 'multipart/alternative;';
00452 }
|
|
|
[Describe function...]
Definition at line 1177 of file class.t3lib_htmlmail.php. 01177 {
01178 // Opens a connection to the server and returns the mime-type of the file
01179 // takes url only
01180 $pathInfo = parse_url($url);
01181 if (!$pathInfo["scheme"]) {return false;}
01182 $getAdr = ($pathInfo["query"])?$pathInfo["path"]."?".$pathInfo["query"]:$pathInfo["path"];
01183 $fp = fsockopen($pathInfo["host"], 80, $errno, $errstr);
01184 if(!$fp) {
01185 return false;
01186 } else {
01187 fputs($fp,"GET ".$getAdr." HTTP/1.0\n\n");
01188 while(!feof($fp)) {
01189 $thePortion= fgets($fp,128);
01190 if (eregi("(^Content-Type: )(.*)",trim($thePortion), $reg)) {
01191 $res = trim($reg[2]);
01192 break;
01193 }
01194 }
01195 fclose($fp);
01196 }
01197 return $res;
01198 }
|
|
|
[Describe function...]
Definition at line 1156 of file class.t3lib_htmlmail.php. References $content. 01156 {
01157 // reads a url or file and strips the HTML-tags AND removes all empty lines. This is used to read plain-text out of a HTML-page
01158 if($fd = fopen($url,"rb")) {
01159 $content = "";
01160 while (!feof($fd)) {
01161 $line = fgetss($fd, 5000);
01162 if (trim($line)) {
01163 $content.=trim($line)."\n";
01164 }
01165 }
01166 fclose( $fd );
01167 return $content;
01168 }
01169 }
|
|
|
[Describe function...]
Definition at line 1135 of file class.t3lib_htmlmail.php. References $content. Referenced by t3lib_formmail::addAttachment(). 01135 {
01136 $url = $this->addUserPass($url);
01137 // reads a url or file
01138 if($fd = @fopen($url,"rb")) {
01139 $content = "";
01140 while (!feof($fd)) {
01141 $content.=fread( $fd, 5000 );
01142 }
01143 fclose( $fd );
01144 return $content;
01145 } else {
01146 return false;
01147 }
01148 }
|
|
|
Definition at line 1089 of file class.t3lib_htmlmail.php. Referenced by encodeMsg(). 01089 {
01090 // Returns base64-encoded content, which is broken every 76 character
01091 return chunk_split(base64_encode($inputstr));
01092 }
|
|
|
[Describe function...]
Definition at line 729 of file class.t3lib_htmlmail.php. 00729 {
00730 echo nl2br(HTMLSpecialChars($this->headers));
00731 echo "<BR>";
00732 echo nl2br(HTMLSpecialChars($this->message));
00733 }
|
|
|
[Describe function...]
Definition at line 1330 of file class.t3lib_htmlmail.php. References $val. Referenced by encodeMsg(). 01330 {
01331 // This functions is buggy. It seems that in the part where the lines are breaked every 76th character, that it fails if the break happens right in a quoted_printable encode character!
01332 $newString = "";
01333 $theLines = explode(chr(10),$string); // Break lines. Doesn't work with mac eol's which seems to be 13. But 13-10 or 10 will work
01334 while (list(,$val)=each($theLines)) {
01335 $val = ereg_replace(chr(13)."$","",$val); // removes possible character 13 at the end of line
01336
01337 $newVal = "";
01338 $theValLen = strlen($val);
01339 $len = 0;
01340 for ($index=0;$index<$theValLen;$index++) {
01341 $char = substr($val,$index,1);
01342 $ordVal =Ord($char);
01343 if ($len>(76-4) || ($len>(66-4)&&$ordVal==32)) {
01344 $len=0;
01345 $newVal.="=".chr(13).chr(10);
01346 }
01347 if (($ordVal>=33 && $ordVal<=60) || ($ordVal>=62 && $ordVal<=126) || $ordVal==9 || $ordVal==32) {
01348 $newVal.=$char;
01349 $len++;
01350 } else {
01351 $newVal.=sprintf("=%02X",$ordVal);
01352 $len+=3;
01353 }
01354 }
01355 $newVal = ereg_replace(chr(32)."$","=20",$newVal); // replaces a possible SPACE-character at the end of a line
01356 $newVal = ereg_replace(chr(9)."$","=09",$newVal); // replaces a possible TAB-character at the end of a line
01357 $newString.=$newVal.chr(13).chr(10);
01358 }
01359 return $newString;
01360 }
|
|
|
[Describe function...]
Definition at line 349 of file class.t3lib_htmlmail.php. References sendTheMail(), setContent(), and setHeaders(). 00349 {
00350 // This function sends the mail to one $recipient
00351 if ($recipient) {$this->recipient = $recipient;}
00352 $this->setHeaders();
00353 $this->setContent();
00354 $this->sendTheMail();
00355 }
|
|
|
[Describe function...]
Definition at line 602 of file class.t3lib_htmlmail.php. Referenced by send(). 00602 {
00603 // Sends the mail.
00604 // Requires the recipient, message and headers to be set.
00605 #debug(array($this->recipient,$this->subject,$this->message,$this->headers));
00606 if (trim($this->recipient) && trim($this->message)) { // && trim($this->headers)
00607 $returnPath = (strlen($this->returnPath)>0)?"-f".$this->returnPath:'';
00608 //On windows the -f flag is not used (specific for sendmail and postfix), but instead the php.ini parameter sendmail_from is used.
00609 if($this->returnPath) {
00610 ini_set(sendmail_from, $this->returnPath);
00611 }
00612 //If safe mode is on, the fifth parameter to mail is not allowed, so the fix wont work on unix with safe_mode=On
00613 if(!ini_get('safe_mode')) {
00614 mail( $this->recipient,
00615 $this->subject,
00616 $this->message,
00617 $this->headers,
00618 $returnPath);
00619 }
00620 else {
00621 mail( $this->recipient,
00622 $this->subject,
00623 $this->message,
00624 $this->headers);
00625 }
00626 // Sending copy:
00627 if ($this->recipient_copy) {
00628 if(!ini_get('safe_mode')) {
00629 mail( $this->recipient_copy,
00630 $this->subject,
00631 $this->message,
00632 $this->headers,
00633 $returnPath);
00634 }
00635 else {
00636 mail( $this->recipient_copy,
00637 $this->subject,
00638 $this->message,
00639 $this->headers );
00640 }
00641 }
00642 // Auto response
00643 if ($this->auto_respond_msg) {
00644 $theParts = explode("/",$this->auto_respond_msg,2);
00645 $theParts[1] = str_replace("/",chr(10),$theParts[1]);
00646 mail( $this->from_email,
00647 $theParts[0],
00648 $theParts[1],
00649 "From: ".$this->recipient,
00650 $returnPath);
00651 }
00652 if($this->returnPath) {
00653 ini_restore(sendmail_from);
00654 }
00655 return true;
00656 } else {return false;}
00657 }
|
|
|
[Describe function...]
Definition at line 459 of file class.t3lib_htmlmail.php. References message(). Referenced by t3lib_dmailer::dmailer_sendAdvanced(), t3lib_dmailer::dmailer_sendSimple(), send(), and t3lib_formmail::start(). 00459 {
00460 // Begins building the message-body
00461 $this->message = "";
00462 $boundary = $this->getBoundary();
00463 // Setting up headers
00464 if (count($this->theParts["attach"])) {
00465 $this->add_header('Content-Type: multipart/mixed;');
00466 $this->add_header(' boundary="'.$boundary.'"');
00467 $this->add_message("This is a multi-part message in MIME format.\n");
00468 $this->constructMixed($boundary); // Generate (plain/HTML) / attachments
00469 } elseif ($this->theParts["html"]["content"]) {
00470 $this->add_header('Content-Type: '.$this->getHTMLContentType());
00471 $this->add_header(' boundary="'.$boundary.'"');
00472 $this->add_message("This is a multi-part message in MIME format.\n");
00473 $this->constructHTML($boundary); // Generate plain/HTML mail
00474 } else {
00475 $this->add_header($this->plain_text_header);
00476 $this->add_message($this->getContent("plain")); // Generate plain only
00477 }
00478 }
|
|
|
Definition at line 378 of file class.t3lib_htmlmail.php. References add_header(). Referenced by t3lib_dmailer::dmailer_sendAdvanced(), t3lib_dmailer::dmailer_sendSimple(), send(), and t3lib_formmail::start(). 00378 {
00379 // Clears the header-string and sets the headers based on object-vars.
00380 $this->headers = "";
00381 // Message_id
00382 $this->add_header("Message-ID: <".$this->messageid.">");
00383 // Return path
00384 if ($this->returnPath) {
00385 $this->add_header("Return-Path: ".$this->returnPath);
00386 }
00387 // X-id
00388 if ($this->Xid) {
00389 $this->add_header("X-Typo3MID: ".$this->Xid);
00390 }
00391
00392 // From
00393 if ($this->from_email) {
00394 if ($this->from_name) {
00395 $name = $this->convertName($this->from_name);
00396 $this->add_header("From: $name <$this->from_email>");
00397 } else {
00398 $this->add_header("From: $this->from_email");
00399 }
00400 }
00401 // Reply
00402 if ($this->replyto_email) {
00403 if ($this->replyto_name) {
00404 $name = $this->convertName($this->replyto_name);
00405 $this->add_header("Reply-To: $name <$this->replyto_email>");
00406 } else {
00407 $this->add_header("Reply-To: $this->replyto_email");
00408 }
00409 }
00410 // Organisation
00411 if ($this->organisation) {
00412 $name = $this->convertName($this->organisation);
00413 $this->add_header("Organisation: $name");
00414 }
00415 // mailer
00416 if ($this->mailer) {
00417 $this->add_header("X-Mailer: $this->mailer");
00418 }
00419 // priority
00420 if ($this->priority) {
00421 $this->add_header("X-Priority: $this->priority");
00422 }
00423 $this->add_header("Mime-Version: 1.0");
00424 }
|
|
|
[Describe function...]
Definition at line 687 of file class.t3lib_htmlmail.php. 00687 {
00688 // Sets the HTML-part. No processing done.
00689 $this->theParts["html"]["content"] = $content;
00690 }
|
|
|
[Describe function...]
Definition at line 676 of file class.t3lib_htmlmail.php. Referenced by addPlain(). 00676 {
00677 // Sets the plain-text part. No processing done.
00678 $this->theParts["plain"]["content"] = $content;
00679 }
|
|
|
[Describe function...]
Definition at line 432 of file class.t3lib_htmlmail.php. Referenced by t3lib_dmailer::dmailer_sendAdvanced(), t3lib_dmailer::dmailer_sendSimple(), and t3lib_formmail::start(). 00432 {
00433 // Sets the recipient(s). If you supply a string, you set one recipient. If you supply an array, every value is added as a recipient.
00434 if (is_array($recip)) {
00435 $this->recipient = "";
00436 while (list($key,) = each($recip)) {
00437 $this->recipient .= $recip[$key].",";
00438 }
00439 $this->recipient = ereg_replace(",$","",$this->recipient);
00440 } else {
00441 $this->recipient = $recip;
00442 }
00443 }
|
|
|
[Describe function...]
Definition at line 1226 of file class.t3lib_htmlmail.php. Referenced by addAttachment(), and t3lib_formmail::addAttachment(). 01226 {
01227 // Returns an array with path, filename, filebody, fileext.
01228 if ( ereg("(.*/)(.*)$",$fileref,$reg) ) {
01229 $info["path"] = $reg[1];
01230 $info["file"] = $reg[2];
01231 } else {
01232 $info["path"] = "";
01233 $info["file"] = $fileref;
01234 }
01235 $reg="";
01236 if ( ereg("(.*)\.([^\.]*$)",$info["file"],$reg) ) {
01237 $info["filebody"] = $reg[1];
01238 $info["fileext"] = strtolower($reg[2]);
01239 $info["realFileext"] = $reg[2];
01240 } else {
01241 $info["filebody"] = $info["file"];
01242 $info["fileext"] = "";
01243 }
01244 return $info;
01245 }
|
|
|
Definition at line 253 of file class.t3lib_htmlmail.php. 00253 {
00254 // Sets the message id
00255 $this->messageid = md5(microtime()).'@domain.tld';
00256 }
|
|
|
[Describe function...]
Definition at line 974 of file class.t3lib_htmlmail.php. References $val. Referenced by addHTML(). 00974 {
00975 // This substitutes the hrefs in $this->theParts["html"]["content"]
00976 if (is_array($this->theParts["html"]["hrefs"])) {
00977 reset ($this->theParts["html"]["hrefs"]);
00978 while (list($key,$val) = each ($this->theParts["html"]["hrefs"])) {
00979 if ($this->jumperURL_prefix && $val["tag"]!="form") { // Form elements cannot use jumpurl!
00980 if ($this->jumperURL_useId) {
00981 $theSubstVal = $this->jumperURL_prefix.$key;
00982 } else {
00983 $theSubstVal = $this->jumperURL_prefix.rawurlencode($val["absRef"]);
00984 }
00985 } else {
00986 $theSubstVal = $val["absRef"];
00987 }
00988 $this->theParts["html"]["content"] = str_replace(
00989 $val["subst_str"],
00990 $val["quotes"].$theSubstVal.$val["quotes"],
00991 $this->theParts["html"]["content"] );
00992 }
00993 }
00994 }
|
|
|
[Describe function...]
Definition at line 1002 of file class.t3lib_htmlmail.php. References $content. Referenced by addPlain(). 01002 {
01003 // This substitutes the http:// urls in plain text with links
01004 if ($this->jumperURL_prefix) {
01005 $textpieces = explode("http://", $content);
01006 $pieces = count($textpieces);
01007 $textstr = $textpieces[0];
01008 for($i=1; $i<$pieces; $i++) {
01009 $len=strcspn($textpieces[$i],chr(32).chr(9).chr(13).chr(10));
01010 if (trim(substr($textstr,-1))=="" && $len) {
01011 $lastChar=substr($textpieces[$i],$len-1,1);
01012 if (!ereg("[A-Za-z0-9\/#]",$lastChar)) {$len--;} // Included "\/" 3/12
01013
01014 $parts[0]="http://".substr($textpieces[$i],0,$len);
01015 $parts[1]=substr($textpieces[$i],$len);
01016
01017 if ($this->jumperURL_useId) {
01018 $this->theParts["plain"]["link_ids"][$i]=$parts[0];
01019 $parts[0] = $this->jumperURL_prefix."-".$i;
01020 } else {
01021 $parts[0] = $this->jumperURL_prefix.rawurlencode($parts[0]);
01022 }
01023 // debug($parts);
01024 $textstr.=$parts[0].$parts[1];
01025 } else {
01026 $textstr.='http://'.$textpieces[$i];
01027 }
01028 }
01029 $content = $textstr;
01030 // debug(array($textstr));
01031 // debug(md5($textstr));
01032 // debug(md5($content));
01033 }
01034 return $content;
01035 }
|
|
|
[Describe function...]
Definition at line 947 of file class.t3lib_htmlmail.php. References $val. Referenced by addHTML(). 00947 {
00948 // This substitutes the media-references in $this->theParts["html"]["content"]
00949 // If $absolute is true, then the refs are substituted with http:// ref's indstead of Content-ID's (cid).
00950 if (is_array($this->theParts["html"]["media"])) {
00951 reset ($this->theParts["html"]["media"]);
00952 while (list($key,$val) = each ($this->theParts["html"]["media"])) {
00953 if ($val["use_jumpurl"] && $this->jumperURL_prefix) {
00954 $theSubstVal = $this->jumperURL_prefix.rawurlencode($val["absRef"]);
00955 } else {
00956 $theSubstVal = ($absolute) ? $val["absRef"] : "cid:part".$key.".".$this->messageid;
00957 }
00958 $this->theParts["html"]["content"] = str_replace(
00959 $val["subst_str"],
00960 $val["quotes"].$theSubstVal.$val["quotes"],
00961 $this->theParts["html"]["content"] );
00962 }
00963 }
00964 if (!$absolute) {
00965 $this->fixRollOvers();
00966 }
00967 }
|
|
|
[Describe function...]
Definition at line 1268 of file class.t3lib_htmlmail.php. 01268 {
01269 if (!is_array($tagArray)) {
01270 $tagArray=Array($tagArray);
01271 }
01272 $theRegex = "";
01273 $c=count($tagArray);
01274 while(list(,$tag)=each($tagArray)) {
01275 $c--;
01276 $theRegex.="<".sql_regcase($tag)."[[:space:]]".(($c)?"|":"");
01277 }
01278 return $theRegex;
01279 }
|
|
|
[Describe function...]
Definition at line 263 of file class.t3lib_htmlmail.php. Referenced by t3lib_dmailer::dmailer_prepare(), t3lib_dmailer::dmailer_sendSimple(), and t3lib_formmail::start(). 00263 {
00264 $this->plain_text_header = 'Content-Type: text/plain; charset=iso-8859-1'.chr(10).'Content-Transfer-Encoding: base64';
00265 $this->html_text_header = 'Content-Type: text/html; charset=iso-8859-1'.chr(10).'Content-Transfer-Encoding: base64';
00266 $this->alt_base64=1;
00267 }
|
|
|
Definition at line 202 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 1321 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 195 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 196 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 232 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 236 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 239 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 206 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 207 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 235 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 203 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 204 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 201 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 205 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 233 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 228 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 199 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 234 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 238 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 200 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 192 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 193 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 197 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 198 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 229 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 194 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 226 of file class.t3lib_htmlmail.php. |
|
|
Definition at line 230 of file class.t3lib_htmlmail.php. |
1.3.8-20040913