ugrás a tartalomhoz

php levélküldés Freewebről

Anonymous · 2005. Okt. 6. (Cs), 06.28
Helló, nagyon sakálhülye problémám van, amit nem tudok megoldani, holott felkínálják a megoldást, de nekem sajna kínai...

"A nálunk regisztrált tárhelyeken a PHP mail() függvénye illetve a Perl CGI-ből történő levélküldés visszaélések megakadályozása miatt korlátozva van.

Azoknak a felhasználóinknak, akik jóhiszeműen szeretnék használni a scriptekből történő levélküldést, továbbra is megtehetik, az alábbiak figyelembevételével:

Bejelentkezés után a "PHP/CGI levélküldés" menüpontban az "azonosító generálása" gombra kattintva aktiválni kell a szolgáltatást. Ha már aktiváltad a szolgáltatást, a gomb helyén az azonosítód jelenik meg.
Naponta (24 óra alatt) maximum 50 levél küldhető el.
Egy e-mail maximum 5 címzettet tartalmazhat összesen, együttvéve a To:, Cc:, Bcc: mezőket.
A levelek header részébe be kell illesztened a következő sort:

X-FW-MailID: azonosító
ahol az azonosító helyére az általunk generált karaktersorozatot kell beírnod.
Példa: PHP esetén a mail() függvény 4. paraméterében (additional headers) tudod megadni, azaz: mail("címzett e-mail címe","levél tárgya","levél szövege","X-FW-MailID: azonosító");"

eddig a freeweb.hu leírása... csakhogy fogalmam sincsen melyik a 4. függvény. gondolom, a file, amiben ez az egész van, az a 'emailer.php' (php-Nuke esetén), és en ebből az adathalmazból sajna nem értek semmit...:
  1. <?php  
  2. if (!defined('IN_PHPBB')) {  
  3.     die();  
  4. }  
  5.   
  6. class emailer  
  7. {  
  8.         var $msg$subject$extra_headers;  
  9.         var $addresses$reply_to$from;  
  10.         var $use_smtp;  
  11.   
  12.         var $tpl_msg = array();  
  13.   
  14.         function emailer($use_smtp)  
  15.         {  
  16.                 $this->reset();  
  17.                 $this->use_smtp = $use_smtp;  
  18.         $this->reply_to = $this->from = '';  
  19.     }  
  20.   
  21.     // Resets all the data (address, template file, etc etc to default  
  22.     function reset()  
  23.     {  
  24.         $this->addresses = array();  
  25.         $this->vars = $this->msg = $this->extra_headers = '';  
  26.     }  
  27.   
  28.     // Sets an email address to send to  
  29.     function email_address($address)  
  30.     {  
  31.         $this->addresses['to'] = trim($address);  
  32.     }  
  33.   
  34.     function cc($address)  
  35.     {  
  36.         $this->addresses['cc'][] = trim($address);  
  37.     }  
  38.   
  39.     function bcc($address)  
  40.     {  
  41.         $this->addresses['bcc'][] = trim($address);  
  42.     }  
  43.   
  44.     function replyto($address)  
  45.     {  
  46.         $this->reply_to = trim($address);  
  47.         }  
  48.   
  49.         function from($address)  
  50.         {  
  51.                 $this->from = trim($address);  
  52.         }  
  53.   
  54.         // set up subject for mail  
  55.         function set_subject($subject = '')  
  56.         {  
  57.                 $this->subject = trim(preg_replace('#[\n\r]+#s'''$subject));  
  58.         }  
  59.   
  60.         // set up extra mail headers  
  61.         function extra_headers($headers)  
  62.         {  
  63.                 $this->extra_headers .= trim($headers) . "\n";  
  64.         }  
  65.   
  66.         function use_template($template_file$template_lang = '')  
  67.         {  
  68.                 global $board_config$phpbb_root_path;  
  69.   
  70.                 if (trim($template_file) == '')  
  71.                 {  
  72.                         message_die(GENERAL_ERROR, 'No template file set'''__LINE____FILE__);  
  73.                 }  
  74.   
  75.                 if (trim($template_lang) == '')  
  76.                 {  
  77.                         $template_lang = $board_config['default_lang'];  
  78.                 }  
  79.   
  80.                 if (emptyempty($this->tpl_msg[$template_lang . $template_file]))  
  81.                 {  
  82.                         $tpl_file = $phpbb_root_path . 'language/lang_' . $template_lang . '/email/' . $template_file . '.tpl';  
  83.   
  84.                         if (!@file_exists(@phpbb_realpath($tpl_file)))  
  85.                         {  
  86.                                 $tpl_file = $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/email/' . $template_file . '.tpl';  
  87.   
  88.                                 if (!@file_exists(@phpbb_realpath($tpl_file)))  
  89.                                 {  
  90.                                         message_die(GENERAL_ERROR, 'Could not find email template file :: ' . $template_file''__LINE____FILE__);  
  91.                                 }  
  92.                         }  
  93.   
  94.                         if (!($fd = @fopen($tpl_file'r')))  
  95.                         {  
  96.                                 message_die(GENERAL_ERROR, 'Failed opening template file :: ' . $tpl_file''__LINE____FILE__);  
  97.                         }  
  98.   
  99.                         $this->tpl_msg[$template_lang . $template_file] = fread($fdfilesize($tpl_file));  
  100.                         fclose($fd);  
  101.                 }  
  102.   
  103.                 $this->msg = $this->tpl_msg[$template_lang . $template_file];  
  104.   
  105.                 return true;  
  106.         }  
  107.   
  108.         // assign variables  
  109.         function assign_vars($vars)  
  110.         {  
  111.                 $this->vars = (emptyempty($this->vars)) ? $vars : $this->vars . $vars;  
  112.         }  
  113.   
  114.         // Send the mail out to the recipients set previously in var $this->address  
  115.         function send()  
  116.         {  
  117.                 global $board_config$lang$phpEx$phpbb_root_path$db;  
  118.   
  119.             // Escape all quotes, else the eval will fail.  
  120.                 $this->msg = str_replace ("'""\'"$this->msg);  
  121.                 $this->msg = preg_replace('#\{([a-z0-9\-_]*?)\}#is'"' . $\\1 . '"$this->msg);  
  122.   
  123.                 // Set vars  
  124.                 reset ($this->vars);  
  125.                 while (list($key$val) = each($this->vars))  
  126.                 {  
  127.                         $$key = $val;  
  128.                 }  
  129.   
  130.                 eval("\$this->msg = '$this->msg';");  
  131.   
  132.                 // Clear vars  
  133.                 reset ($this->vars);  
  134.                 while (list($key$val) = each($this->vars))  
  135.                 {  
  136.                         unset($$key);  
  137.                 }  
  138.   
  139.                 // We now try and pull a subject from the email body ... if it exists,  
  140.                 // do this here because the subject may contain a variable  
  141.                 $drop_header = '';  
  142.                 $match = array();  
  143.                 if (preg_match('#^(Subject:(.*?))$#m'$this->msg, $match))  
  144.                 {  
  145.                         $this->subject = (trim($match[2]) != '') ? trim($match[2]) : (($this->subject != '') ? $this->subject : 'No Subject');  
  146.                         $drop_header .= '[\r\n]*?' . phpbb_preg_quote($match[1], '#');  
  147.                 }  
  148.                 else  
  149.                 {  
  150.                         $this->subject = (($this->subject != '') ? $this->subject : 'No Subject');  
  151.                 }  
  152.   
  153.                 if (preg_match('#^(Charset:(.*?))$#m'$this->msg, $match))  
  154.                 {  
  155.                         $this->encoding = (trim($match[2]) != '') ? trim($match[2]) : trim($lang['ENCODING']);  
  156.                         $drop_header .= '[\r\n]*?' . phpbb_preg_quote($match[1], '#');  
  157.                 }  
  158.                 else  
  159.                 {  
  160.                         $this->encoding = trim($lang['ENCODING']);  
  161.                 }  
  162.   
  163.                 if ($drop_header != '')  
  164.                 {  
  165.                         $this->msg = trim(preg_replace('#' . $drop_header . '#s'''$this->msg));  
  166.                 }  
  167.   
  168.         $to = $this->addresses['to'];  
  169.   
  170.         $cc = (count($this->addresses['cc'])) ? implode(', '$this->addresses['cc']) : '';  
  171.         $bcc = (count($this->addresses['bcc'])) ? implode(', '$this->addresses['bcc']) : '';  
  172.   
  173.         // Build header  
  174.         $this->extra_headers = (($this->reply_to != '') ? "Reply-to: $this->reply_to\n" : '') . (($this->from != '') ? "From: $this->from\n" : "From: " . $board_config['board_email'] . "\n") . "Return-Path: " . $board_config['board_email'] . "\nMessage-ID: <" . md5(uniqid(time())) . "@" . $board_config['server_name'] . ">\nMIME-Version: 1.0\nContent-type: text/plain; charset=" . $this->encoding . "\nContent-transfer-encoding: 8bit\nDate: " . date('r', time()) . "\nX-Priority: 3\nX-MSMail-Priority: Normal\nX-Mailer: PHP\nX-MimeOLE: Produced By phpBB2\n" . $this->extra_headers . (($cc != '') ? "Cc: $cc\n" : '')  . (($bcc != '') ? "Bcc: $bcc\n" : '');  
  175.   
  176.                 // Send message ... removed $this->encode() from subject for time being  
  177.                 if ( $this->use_smtp )  
  178.                 {  
  179.                         if ( !defined('SMTP_INCLUDED') )  
  180.                         {  
  181.                                 @include("includes/smtp.php");  
  182.                         }  
  183.   
  184.                         $result = smtpmail($to$this->subject, $this->msg, $this->extra_headers);  
  185.                 }  
  186.                 else  
  187.                 {  
  188.             $empty_to_header = ($to == '') ? TRUE : FALSE;  
  189.             $to = ($to == '') ? (($board_config['sendmail_fix']) ? ' ' : 'Undisclosed-recipients:;') : $to;  
  190.                         $result = @mail($to$this->subject, preg_replace("#(?<!\r)\n#s""\n"$this->msg), $this->extra_headers);  
  191.   
  192.                         if (!$result && !$board_config['sendmail_fix'] && $empty_to_header)  
  193.                         {  
  194.                                 $to = ' ';  
  195.   
  196.                                 $sql = "UPDATE " . CONFIG_TABLE . "  
  197.                                         SET config_value = '1'  
  198.                                         WHERE config_name = 'sendmail_fix'";  
  199.                                 if (!$db->sql_query($sql))  
  200.                                 {  
  201.                                         message_die(GENERAL_ERROR, 'Unable to update config table'''__LINE____FILE__$sql);  
  202.                                 }  
  203.   
  204.                                 $board_config['sendmail_fix'] = 1;  
  205.                                 $result = @mail($to$this->subject, preg_replace("#(?<!\r)\n#s""\n"$this->msg), $this->extra_headers);  
  206.                         }  
  207.                 }  
  208.   
  209.                 // Did it work?  
  210.                 if (!$result)  
  211.                 {  
  212.                         message_die(GENERAL_ERROR, 'Failed sending email :: ' . (($this->use_smtp) ? 'SMTP' : 'PHP') . ' :: ' . $result''__LINE____FILE__);  
  213.                 }  
  214.   
  215.                 return true;  
  216.         }  
  217.   
  218.         // Encodes the given string for proper display for this encoding ... nabbed  
  219.         // from php.net and modified. There is an alternative encoding method which  
  220.         // may produce lesd output but it's questionable as to its worth in this  
  221.         // scenario IMO  
  222.         function encode($str)  
  223.         {  
  224.                 if ($this->encoding == '')  
  225.                 {  
  226.                         return $str;  
  227.                 }  
  228.   
  229.                 // define start delimimter, end delimiter and spacer  
  230.                 $end = "?=";  
  231.                 $start = "=?$this->encoding?B?";  
  232.                 $spacer = "$end\r\n $start";  
  233.   
  234.                 // determine length of encoded text within chunks and ensure length is even  
  235.                 $length = 75 - strlen($start) - strlen($end);  
  236.                 $length = floor($length / 2) * 2;  
  237.   
  238.                 // encode the string and split it into chunks with spacers after each chunk  
  239.                 $str = chunk_split(base64_encode($str), $length$spacer);  
  240.   
  241.                 // remove trailing spacer and add start and end delimiters  
  242.                 $str = preg_replace('#' . phpbb_preg_quote($spacer'#') . '$#'''$str);  
  243.   
  244.                 return $start . $str . $end;  
  245.         }  
  246.   
  247.         //  
  248.         // Attach files via MIME.  
  249.         //  
  250.         function attachFile($filename$mimetype = "application/octet-stream"$szFromAddress$szFilenameToDisplay)  
  251.         {  
  252.                 global $lang;  
  253.                 $mime_boundary = "--==================_846811060==_";  
  254.   
  255.                 $this->msg = '--' . $mime_boundary . "\nContent-Type: text/plain;\n\tcharset=\"" . $lang['ENCODING'] . "\"\n\n" . $this->msg;  
  256.   
  257.                 if ($mime_filename)  
  258.                 {  
  259.                         $filename = $mime_filename;  
  260.                         $encoded = $this->encode_file($filename);  
  261.                 }  
  262.   
  263.                 $fd = fopen($filename"r");  
  264.                 $contents = fread($fdfilesize($filename));  
  265.   
  266.                 $this->mimeOut = "--" . $mime_boundary . "\n";  
  267.                 $this->mimeOut .= "Content-Type: " . $mimetype . ";\n\tname=\"$szFilenameToDisplay\"\n";  
  268.                 $this->mimeOut .= "Content-Transfer-Encoding: quoted-printable\n";  
  269.                 $this->mimeOut .= "Content-Disposition: attachment;\n\tfilename=\"$szFilenameToDisplay\"\n\n";  
  270.   
  271.                 if ( $mimetype == "message/rfc822" )  
  272.                 {  
  273.                         $this->mimeOut .= "From: ".$szFromAddress."\n";  
  274.                         $this->mimeOut .= "To: ".$this->emailAddress."\n";  
  275.                         $this->mimeOut .= "Date: ".date("D, d M Y H:i:s") . " UT\n";  
  276.                         $this->mimeOut .= "Reply-To:".$szFromAddress."\n";  
  277.                         $this->mimeOut .= "Subject: ".$this->mailSubject."\n";  
  278.                         $this->mimeOut .= "X-Mailer: PHP/".phpversion()."\n";  
  279.                         $this->mimeOut .= "MIME-Version: 1.0\n";  
  280.                 }  
  281.   
  282.                 $this->mimeOut .= $contents."\n";  
  283.                 $this->mimeOut .= "--" . $mime_boundary . "--" . "\n";  
  284.   
  285.                 return $out;  
  286.                 // added -- to notify email client attachment is done  
  287.         }  
  288.   
  289.         function getMimeHeaders($filename$mime_filename="")  
  290.         {  
  291.                 $mime_boundary = "--==================_846811060==_";  
  292.   
  293.                 if ($mime_filename)  
  294.                 {  
  295.                         $filename = $mime_filename;  
  296.                 }  
  297.   
  298.                 $out = "MIME-Version: 1.0\n";  
  299.                 $out .= "Content-Type: multipart/mixed;\n\tboundary=\"$mime_boundary\"\n\n";  
  300.                 $out .= "This message is in MIME format. Since your mail reader does not understand\n";  
  301.                 $out .= "this format, some or all of this message may not be legible.";  
  302.   
  303.                 return $out;  
  304.         }  
  305.   
  306.         //  
  307.    // Split string by RFC 2045 semantics (76 chars per line, end with \r\n).  
  308.         //  
  309.         function myChunkSplit($str)  
  310.         {  
  311.                 $stmp = $str;  
  312.                 $len = strlen($stmp);  
  313.                 $out = "";  
  314.   
  315.                 while ($len > 0)  
  316.                 {  
  317.                         if ($len >= 76)  
  318.                         {  
  319.                                 $out .= substr($stmp, 0, 76) . "\r\n";  
  320.                                 $stmp = substr($stmp, 76);  
  321.                                 $len = $len - 76;  
  322.                         }  
  323.                         else  
  324.                         {  
  325.                                 $out .= $stmp . "\r\n";  
  326.                                 $stmp = "";  
  327.                                 $len = 0;  
  328.                         }  
  329.                 }  
  330.                 return $out;  
  331.         }  
  332.   
  333.         //  
  334.    // Split the specified file up into a string and return it  
  335.         //  
  336.         function encode_file($sourcefile)  
  337.         {  
  338.                 if (is_readable(phpbb_realpath($sourcefile)))  
  339.                 {  
  340.                         $fd = fopen($sourcefile"r");  
  341.                         $contents = fread($fdfilesize($sourcefile));  
  342.               $encoded = $this->myChunkSplit(base64_encode($contents));  
  343.               fclose($fd);  
  344.                 }  
  345.   
  346.                 return $encoded;  
  347.         }  
  348.   
  349. // class emailer  
  350.   
  351. ?>  
annyi segítségre lenne szükségem, hogy lássam, hová, és hogyan kell beszúrni a fenn mondott sort...

előre is köszönöm: ádám
 
1

<Nincs cím>

Anonymous · 2005. Okt. 6. (Cs), 07.50
Szerintem a legegyszerűbb, bár nem a legszebb ez után hozzácsapni:
  1. "\nX-Priority: 3\nX-MSMail-Priority: Normal\nX-Mailer: PHP\nX-MimeOLE: Produced By phpBB2\n" .  
Vagyis kb így:
  1. "\nX-Priority: 3\nX-MSMail-Priority: Normal\nX-Mailer: PHP\nX-MimeOLE: Produced By phpBB2\n" . "\nX-FW-MailID: azonosito" .  
2

<Nincs cím>

Anonymous · 2005. Okt. 6. (Cs), 08.25
köszönöm szépen! nem baj, ha nem szép, a lényeg, hogy működjön! :)

ádám
3

<Nincs cím>

cannavaro · 2005. Nov. 29. (K), 20.43
Sziasztok!

Nekem is ilyen problémám van hogy nem tudom mail()-t használni a freeweben.

Nekem ilyen a mail()-em:
  1. <?php mail($email,$lettername,$totalmessage,$mailheaders);  
Akkor most szépen bedefiniálm még a headersbe ezt az xn.... valamit?
Valahogy így:
  1. <?php $mailheaders.="\nX-Priority: 3\nX-MSMail-Priority: Normal\nX-Mailer: PHP\nX-MimeOLE: Produced By phpBB2\n" . "\nX-FW-MailID: azonosító";  
Vagy máshogy? nem értek hozzá annyira...

Köszi
4

Hasonló gondok...

Anonymous · 2006. Jún. 12. (H), 00.25
Találtam egy leírást a kövi linken és az alapján próbáltam beírkálni ezeket LINK. Sajnos vmi nem stimmel, mert nem kaptam meg az emaileket:(
A emailer.php-m a kövi:
  1. <?php  
  2. //  
  3. // The emailer class has support for attaching files, that isn't implemented  
  4. // in the 2.0 release but we can probable find some way of using it in a future  
  5. // release  
  6. //  
  7. class emailer  
  8. {  
  9.         var $msg$subject$extra_headers;  
  10.         var $addresses$reply_to$from;  
  11.         var $use_smtp;  
  12.   
  13.         var $tpl_msg = array();  
  14.   
  15.         function emailer($use_smtp)  
  16.         {  
  17.                 $this->reset();  
  18.                 $this->use_smtp = $use_smtp;  
  19.         $this->reply_to = $this->from = '';  
  20.     }  
  21.   
  22.     // Resets all the data (address, template file, etc etc to default  
  23.     function reset()  
  24.     {  
  25.         $this->addresses = array();  
  26.         $this->vars = $this->msg = $this->extra_headers = '';  
  27.     }  
  28.   
  29.     // Sets an email address to send to  
  30.     function email_address($address)  
  31.     {  
  32.         $this->addresses['to'] = trim($address);  
  33.     }  
  34.   
  35.     function cc($address)  
  36.     {  
  37.         $this->addresses['cc'][] = trim($address);  
  38.     }  
  39.   
  40.     function bcc($address)  
  41.     {  
  42.         $this->addresses['bcc'][] = trim($address);  
  43.     }  
  44.   
  45.     function replyto($address)  
  46.     {  
  47.         $this->reply_to = trim($address);  
  48.         }  
  49.   
  50.         function from($address)  
  51.         {  
  52.                 $this->from = trim($address);  
  53.         }  
  54.   
  55.         // set up subject for mail  
  56.         function set_subject($subject = '')  
  57.         {  
  58.                 $this->subject = trim(preg_replace('#[\r]+#s'''$subject));  
  59.         }  
  60.   
  61.         // set up extra mail headers  
  62.         function extra_headers($headers)  
  63.         {  
  64.                 $this->extra_headers .= trim($headers) . "\n";  
  65.         }  
  66.   
  67.         function use_template($template_file$template_lang = '')  
  68.         {  
  69.                 global $board_config$phpbb_root_path;  
  70.   
  71.                 if (trim($template_file) == '')  
  72.                 {  
  73.                         message_die(GENERAL_ERROR, 'No template file set'''__LINE____FILE__);  
  74.                 }  
  75.   
  76.                 if (trim($template_lang) == '')  
  77.                 {  
  78.                         $template_lang = $board_config['default_lang'];  
  79.                 }  
  80.   
  81.                 if (emptyempty($this->tpl_msg[$template_lang . $template_file]))  
  82.                 {  
  83.                         $tpl_file = $phpbb_root_path . 'language/lang_' . $template_lang . '/email/' . $template_file . '.tpl';  
  84.   
  85.                         if (!@file_exists(@phpbb_realpath($tpl_file)))  
  86.                         {  
  87.                                 $tpl_file = $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/email/' . $template_file . '.tpl';  
  88.   
  89.                                 if (!@file_exists(@phpbb_realpath($tpl_file)))  
  90.                                 {  
  91.                                         message_die(GENERAL_ERROR, 'Could not find email template file :: ' . $template_file''__LINE____FILE__);  
  92.                                 }  
  93.                         }  
  94.   
  95.                         if (!($fd = @fopen($tpl_file'r')))  
  96.                         {  
  97.                                 message_die(GENERAL_ERROR, 'Failed opening template file :: ' . $tpl_file''__LINE____FILE__);  
  98.                         }  
  99.   
  100.                         $this->tpl_msg[$template_lang . $template_file] = fread($fdfilesize($tpl_file));  
  101.                         fclose($fd);  
  102.                 }  
  103.   
  104.                 $this->msg = $this->tpl_msg[$template_lang . $template_file];  
  105.   
  106.                 return true;  
  107.         }  
  108.   
  109.         // assign variables  
  110.         function assign_vars($vars)  
  111.         {  
  112.                 $this->vars = (emptyempty($this->vars)) ? $vars : $this->vars . $vars;  
  113.         }  
  114.   
  115.         // Send the mail out to the recipients set previously in var $this->address  
  116.         function send()  
  117.         {  
  118.                 global $board_config$lang$phpEx$phpbb_root_path$db;  
  119.   
  120.             // Escape all quotes, else the eval will fail.  
  121.                 $this->msg = str_replace ("'""\'"$this->msg);  
  122.                 $this->msg = preg_replace('#\{([a-z0-9\-_]*?)\}#is'"' . $\\1 . '"$this->msg);  
  123.   
  124.                 // Set vars  
  125.                 reset ($this->vars);  
  126.                 while (list($key$val) = each($this->vars))  
  127.                 {  
  128.                         $$key = $val;  
  129.                 }  
  130.   
  131.                 eval("\$this->msg = '$this->msg';");  
  132.   
  133.                 // Clear vars  
  134.                 reset ($this->vars);  
  135.                 while (list($key$val) = each($this->vars))  
  136.                 {  
  137.                         unset($$key);  
  138.                 }  
  139.   
  140.                 // We now try and pull a subject from the email body ... if it exists,  
  141.                 // do this here because the subject may contain a variable  
  142.                 $drop_header = '';  
  143.                 $match = array();  
  144.                 if (preg_match('#^(Subject:(.*?))$#m'$this->msg, $match))  
  145.                 {  
  146.                         $this->subject = (trim($match[2]) != '') ? trim($match[2]) : (($this->subject != '') ? $this->subject : 'No Subject');  
  147.                         $drop_header .= '[\r\n]*?' . phpbb_preg_quote($match[1], '#');  
  148.                 }  
  149.                 else  
  150.                 {  
  151.                         $this->subject = (($this->subject != '') ? $this->subject : 'No Subject');  
  152.                 }  
  153.   
  154.                 if (preg_match('#^(Charset:(.*?))$#m'$this->msg, $match))  
  155.                 {  
  156.                         $this->encoding = (trim($match[2]) != '') ? trim($match[2]) : trim($lang['ENCODING']);  
  157.                         $drop_header .= '[\r\n]*?' . phpbb_preg_quote($match[1], '#');  
  158.                 }  
  159.                 else  
  160.                 {  
  161.                         $this->encoding = trim($lang['ENCODING']);  
  162.                 }  
  163.   
  164.                 if ($drop_header != '')  
  165.                 {  
  166.                         $this->msg = trim(preg_replace('#' . $drop_header . '#s'''$this->msg));  
  167.                 }  
  168.   
  169.         $to = $this->addresses['to'];  
  170.   
  171.         $cc = (count($this->addresses['cc'])) ? implode(', '$this->addresses['cc']) : '';  
  172.         $bcc = (count($this->addresses['bcc'])) ? implode(', '$this->addresses['bcc']) : '';  
  173.   
  174.         // Build header  
  175.         $this->extra_headers = (($this->reply_to != '') ? "Reply-to: $this->reply_to\n" : '') . (($this->from != '') ? "From: $this->from\n" : "From: " . $board_config['board_email'] . "\n") . "Return-Path: " . $board_config['board_email'] . "\nMessage-ID: <" . md5(uniqid(time())) . "@" . $board_config['server_name'] . ">\nMIME-Version: 1.0\nContent-type: text/plain; charset=" . $this->encoding . "\nContent-transfer-encoding: 8bit\nDate: " . date('r', time()) . "\nX-Priority: 3\nX-MSMail-Priority: Normal\nX-Mailer: PHP\nX-MimeOLE: Produced By phpBB2\n" . $this->extra_headers . (($cc != '') ? "Cc: $cc\n" : '')  . (($bcc != '') ? "Bcc: $bcc\n" : '');  
  176.   
  177.                 // Send message ... removed $this->encode() from subject for time being  
  178.                 if ( $this->use_smtp )  
  179.                 {  
  180.                         if ( !defined('SMTP_INCLUDED') )  
  181.                         {  
  182.                                 include('includes/smtp.' . $phpEx);  
  183.                         }  
  184.   
  185.                         $result = smtpmail($to$this->subject, $this->msg, "X-FW-MailID: 0a1f1e3a1e"$this->extra_headers);  
  186.                 }  
  187.                 else  
  188.                 {  
  189.             $empty_to_header = ($to == '') ? TRUE : FALSE;  
  190.             $to = ($to == '') ? (($board_config['sendmail_fix']) ? ' ' : 'Undisclosed-recipients:;') : $to;  
  191.                         $result = @mail($to$this->subject, preg_replace("#(?<!\r)\n#s""X-FW-MailID: 0a1f1e3a1e""\n"$this->msg), $this->extra_headers);  
  192.   
  193.                         if (!$result && !$board_config['sendmail_fix'] && $empty_to_header)  
  194.                         {  
  195.                                 $to = ' ';  
  196.   
  197.                                 $sql = "UPDATE " . CONFIG_TABLE . "  
  198.                                         SET config_value = '1'  
  199.                                         WHERE config_name = 'sendmail_fix'";  
  200.                                 if (!$db->sql_query($sql))  
  201.                                 {  
  202.                                         message_die(GENERAL_ERROR, 'Unable to update config table'''__LINE____FILE__$sql);  
  203.                                 }  
  204.   
  205.                                 $board_config['sendmail_fix'] = 1;  
  206.                                 $result = @mail($to$this->subject, preg_replace("#(?<!\r)\n#s""X-FW-MailID: 0a1f1e3a1e""\n"$this->msg), $this->extra_headers);  
  207.                         }  
  208.                 }  
  209.   
  210.                 // Did it work?  
  211.                 if (!$result)  
  212.                 {  
  213.                         message_die(GENERAL_ERROR, 'Failed sending email :: ' . (($this->use_smtp) ? 'SMTP' : 'PHP') . ' :: ' . $result''__LINE____FILE__);  
  214.                 }  
  215.   
  216.                 return true;  
  217.         }  
  218.   
  219.         // Encodes the given string for proper display for this encoding ... nabbed  
  220.         // from php.net and modified. There is an alternative encoding method which  
  221.         // may produce lesd output but it's questionable as to its worth in this  
  222.         // scenario IMO  
  223.         function encode($str)  
  224.         {  
  225.                 if ($this->encoding == '')  
  226.                 {  
  227.                         return $str;  
  228.                 }  
  229.   
  230.                 // define start delimimter, end delimiter and spacer  
  231.                 $end = "?=";  
  232.                 $start = "=?$this->encoding?B?";  
  233.                 $spacer = "$end\r\n $start";  
  234.   
  235.                 // determine length of encoded text within chunks and ensure length is even  
  236.                 $length = 75 - strlen($start) - strlen($end);  
  237.                 $length = floor($length / 2) * 2;  
  238.   
  239.                 // encode the string and split it into chunks with spacers after each chunk  
  240.                 $str = chunk_split(base64_encode($str), $length$spacer);  
  241.   
  242.                 // remove trailing spacer and add start and end delimiters  
  243.                 $str = preg_replace('#' . phpbb_preg_quote($spacer'#') . '$#'''$str);  
  244.   
  245.                 return $start . $str . $end;  
  246.         }  
  247.   
  248.         //  
  249.         // Attach files via MIME.  
  250.         //  
  251.         function attachFile($filename$mimetype = "application/octet-stream"$szFromAddress$szFilenameToDisplay)  
  252.         {  
  253.                 global $lang;  
  254.                 $mime_boundary = "--==================_846811060==_";  
  255.   
  256.                 $this->msg = '--' . $mime_boundary . "\nContent-Type: text/plain;\n\tcharset=\"" . $lang['ENCODING'] . "\"\n\n" . $this->msg;  
  257.   
  258.                 if ($mime_filename)  
  259.                 {  
  260.                         $filename = $mime_filename;  
  261.                         $encoded = $this->encode_file($filename);  
  262.                 }  
  263.   
  264.                 $fd = fopen($filename"r");  
  265.                 $contents = fread($fdfilesize($filename));  
  266.   
  267.                 $this->mimeOut = "--" . $mime_boundary . "\n";  
  268.                 $this->mimeOut .= "Content-Type: " . $mimetype . ";\n\tname=\"$szFilenameToDisplay\"\n";  
  269.                 $this->mimeOut .= "Content-Transfer-Encoding: quoted-printable\n";  
  270.                 $this->mimeOut .= "Content-Disposition: attachment;\n\tfilename=\"$szFilenameToDisplay\"\n\n";  
  271.   
  272.                 if ( $mimetype == "message/rfc822" )  
  273.                 {  
  274.                         $this->mimeOut .= "From: ".$szFromAddress."\n";  
  275.                         $this->mimeOut .= "To: ".$this->emailAddress."\n";  
  276.                         $this->mimeOut .= "Date: ".date("D, d M Y H:i:s") . " UT\n";  
  277.                         $this->mimeOut .= "Reply-To:".$szFromAddress."\n";  
  278.                         $this->mimeOut .= "Subject: ".$this->mailSubject."\n";  
  279.                         $this->mimeOut .= "X-Mailer: PHP/".phpversion()."\n";  
  280.                         $this->mimeOut .= "MIME-Version: 1.0\n";  
  281.                 }  
  282.   
  283.                 $this->mimeOut .= $contents."\n";  
  284.                 $this->mimeOut .= "--" . $mime_boundary . "--" . "\n";  
  285.   
  286.                 return $out;  
  287.                 // added -- to notify email client attachment is done  
  288.         }  
  289.   
  290.         function getMimeHeaders($filename$mime_filename="")  
  291.         {  
  292.                 $mime_boundary = "--==================_846811060==_";  
  293.   
  294.                 if ($mime_filename)  
  295.                 {  
  296.                         $filename = $mime_filename;  
  297.                 }  
  298.   
  299.                 $out = "MIME-Version: 1.0\n";  
  300.                 $out .= "Content-Type: multipart/mixed;\n\tboundary=\"$mime_boundary\"\n\n";  
  301.                 $out .= "This message is in MIME format. Since your mail reader does not understand\n";  
  302.                 $out .= "this format, some or all of this message may not be legible.";  
  303.   
  304.                 return $out;  
  305.         }  
  306.   
  307.         //  
  308.    // Split string by RFC 2045 semantics (76 chars per line, end with \r\n).  
  309.         //  
  310.         function myChunkSplit($str)  
  311.         {  
  312.                 $stmp = $str;  
  313.                 $len = strlen($stmp);  
  314.                 $out = "";  
  315.   
  316.                 while ($len > 0)  
  317.                 {  
  318.                         if ($len >= 76)  
  319.                         {  
  320.                                 $out .= substr($stmp, 0, 76) . "\r\n";  
  321.                                 $stmp = substr($stmp, 76);  
  322.                                 $len = $len - 76;  
  323.                         }  
  324.                         else  
  325.                         {  
  326.                                 $out .= $stmp . "\r\n";  
  327.                                 $stmp = "";  
  328.                                 $len = 0;  
  329.                         }  
  330.                 }  
  331.                 return $out;  
  332.         }  
  333.   
  334.         //  
  335.    // Split the specified file up into a string and return it  
  336.         //  
  337.         function encode_file($sourcefile)  
  338.         {  
  339.                 if (is_readable(phpbb_realpath($sourcefile)))  
  340.                 {  
  341.                         $fd = fopen($sourcefile"r");  
  342.                         $contents = fread($fdfilesize($sourcefile));  
  343.               $encoded = $this->myChunkSplit(base64_encode($contents));  
  344.               fclose($fd);  
  345.                 }  
  346.   
  347.                 return $encoded;  
  348.         }  
  349.   
  350. // class emailer  
  351.   
  352. ?>  
Sajnos nem tudom, h elrontottam e vmit, mert sajnos annyira nem vok otthon a témában de ezt érdemes lenne megtanulni...
5

rossz helyen

vbence · 2006. Jún. 12. (H), 00.49
Látom a mail sorokat megtaláltad, a 4. paraméert viszont nagyon nem...

Az smtpmail -t tartamazó sor átírása föösleges, az smtp küldés úgysem fog működni.

A mail sorában rossz helyre írtad az azonosítót. Sajnos msot biztosan jó sort nem tudok neked küldeni, mert nem látom az eredeti állapotot, de gyanítom ez lenne az:
  1. $result = @mail($to$this->subject, preg_replace("#(?<!\r)\n#s""\n"$this->msg), $this->extra_headers . "\nX-FW-MailID: 0a1f1e3a1e");  
Ha átmenetileg leszeded az AT karaktert (igen, a kukacot) a mail elől, akkor láthatod a hibaüzeneteket. Beállítás közben így könnyebb dolgod lesz.
6

Próba1

Anonymous · 2006. Jún. 12. (H), 01.52
Átírtam, amit mondtál és próbáltam AT nélkül is de nem kaptam hibaüzit csak annyit, amit eddig, h sikeresen elküldve, de még nem kaptam semmit... Majd előszedem az eredetit és felrakom. Addig is köszi!
8

eredeti code

Anonymous · 2006. Jún. 15. (Cs), 22.57
Íme az eredeti, amit átírtam:
  1. <?php  
  2. /*************************************************************************** 
  3.                                 emailer.php 
  4.                              ------------------- 
  5.     begin                : Sunday Aug. 12, 2001 
  6.     copyright            : (C) 2001 The phpBB Group 
  7.     email                : support##kukac##phpbb.com 
  8.  
  9.     $Id: emailer.php,v 1.15.2.29 2003/06/15 12:08:20 acydburn Exp $ 
  10.  
  11. ***************************************************************************/  
  12. /*************************************************************************** 
  13. * phpbb2 forums port version 2.0.5 (c) 2003 - Nuke Cops (http://nukecops.com) 
  14. * 
  15. * Ported by Nuke Cops to phpbb2 standalone 2.0.5 Test 
  16. * and debugging completed by the Elite Nukers and site members. 
  17. * 
  18. * You run this package at your sole risk. Nuke Cops and affiliates cannot 
  19. * be held liable if anything goes wrong. You are advised to test this 
  20. * package on a development system. Backup everything before implementing 
  21. * in a production environment. If something goes wrong, you can always 
  22. * backout and restore your backups. 
  23. * 
  24. * Installing and running this also means you agree to the terms of the AUP 
  25. * found at Nuke Cops. 
  26. * 
  27. * This is version 2.0.5 of the phpbb2 forum port for PHP-Nuke. Work is based 
  28. * on Tom Nitzschner's forum port version 2.0.6. Tom's 2.0.6 port was based 
  29. * on the phpbb2 standalone version 2.0.3. Our version 2.0.5 from Nuke Cops is 
  30. * now reflecting phpbb2 standalone 2.0.5 that fixes some bugs and the 
  31. * invalid_session error message. 
  32. ***************************************************************************/  
  33. /*************************************************************************** 
  34.  *   This file is part of the phpBB2 port to Nuke 6.0 (c) copyright 2002 
  35.  *   by Tom Nitzschner (tom##kukac##toms-home.com) 
  36.  *   http://bbtonuke.sourceforge.net (or http://www.toms-home.com) 
  37.  * 
  38.  *   As always, make a backup before messing with anything. All code 
  39.  *   release by me is considered sample code only. It may be fully 
  40.  *   functual, but you use it at your own risk, if you break it, 
  41.  *   you get to fix it too. No waranty is given or implied. 
  42.  * 
  43.  *   Please post all questions/request about this port on http://bbtonuke.sourceforge.net first, 
  44.  *   then on my site. All original header code and copyright messages will be maintained 
  45.  *   to give credit where credit is due. If you modify this, the only requirement is 
  46.  *   that you also maintain all original copyright messages. All my work is released 
  47.  *   under the GNU GENERAL PUBLIC LICENSE. Please see the README for more information. 
  48.  * 
  49.  ***************************************************************************/  
  50. /*************************************************************************** 
  51.  * 
  52.  *   This program is free software; you can redistribute it and/or modify 
  53.  *   it under the terms of the GNU General Public License as published by 
  54.  *   the Free Software Foundation; either version 2 of the License, or 
  55.  *   (at your option) any later version. 
  56.  * 
  57.  ***************************************************************************/  
  58.   
  59. //  
  60. // The emailer class has support for attaching files, that isn't implemented  
  61. // in the 2.0 release but we can probable find some way of using it in a future  
  62. // release  
  63. //  
  64. class emailer  
  65. {  
  66.         var $msg$subject$extra_headers;  
  67.         var $addresses$reply_to$from;  
  68.         var $use_smtp;  
  69.   
  70.         var $tpl_msg = array();  
  71.   
  72.         function emailer($use_smtp)  
  73.         {  
  74.                 $this->reset();  
  75.                 $this->use_smtp = $use_smtp;  
  76.         $this->reply_to = $this->from = '';  
  77.     }  
  78.   
  79.     // Resets all the data (address, template file, etc etc to default  
  80.     function reset()  
  81.     {  
  82.         $this->addresses = array();  
  83.         $this->vars = $this->msg = $this->extra_headers = '';  
  84.     }  
  85.   
  86.     // Sets an email address to send to  
  87.     function email_address($address)  
  88.     {  
  89.         $this->addresses['to'] = trim($address);  
  90.     }  
  91.   
  92.     function cc($address)  
  93.     {  
  94.         $this->addresses['cc'][] = trim($address);  
  95.     }  
  96.   
  97.     function bcc($address)  
  98.     {  
  99.         $this->addresses['bcc'][] = trim($address);  
  100.     }  
  101.   
  102.     function replyto($address)  
  103.     {  
  104.         $this->reply_to = trim($address);  
  105.         }  
  106.   
  107.         function from($address)  
  108.         {  
  109.                 $this->from = trim($address);  
  110.         }  
  111.   
  112.         // set up subject for mail  
  113.         function set_subject($subject = '')  
  114.         {  
  115.                 $this->subject = trim(preg_replace('#[\r]+#s'''$subject));  
  116.         }  
  117.   
  118.         // set up extra mail headers  
  119.         function extra_headers($headers)  
  120.         {  
  121.                 $this->extra_headers .= trim($headers) . "\n";  
  122.         }  
  123.   
  124.         function use_template($template_file$template_lang = '')  
  125.         {  
  126.                 global $board_config$phpbb_root_path;  
  127.   
  128.                 if (trim($template_file) == '')  
  129.                 {  
  130.                         message_die(GENERAL_ERROR, 'No template file set'''__LINE____FILE__);  
  131.                 }  
  132.   
  133.                 if (trim($template_lang) == '')  
  134.                 {  
  135.                         $template_lang = $board_config['default_lang'];  
  136.                 }  
  137.   
  138.                 if (emptyempty($this->tpl_msg[$template_lang . $template_file]))  
  139.                 {  
  140.                         $tpl_file = $phpbb_root_path . 'language/lang_' . $template_lang . '/email/' . $template_file . '.tpl';  
  141.   
  142.                         if (!@file_exists(@phpbb_realpath($tpl_file)))  
  143.                         {  
  144.                                 $tpl_file = $phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/email/' . $template_file . '.tpl';  
  145.   
  146.                                 if (!@file_exists(@phpbb_realpath($tpl_file)))  
  147.                                 {  
  148.                                         message_die(GENERAL_ERROR, 'Could not find email template file :: ' . $template_file''__LINE____FILE__);  
  149.                                 }  
  150.                         }  
  151.   
  152.                         if (!($fd = @fopen($tpl_file'r')))  
  153.                         {  
  154.                                 message_die(GENERAL_ERROR, 'Failed opening template file :: ' . $tpl_file''__LINE____FILE__);  
  155.                         }  
  156.   
  157.                         $this->tpl_msg[$template_lang . $template_file] = fread($fdfilesize($tpl_file));  
  158.                         fclose($fd);  
  159.                 }  
  160.   
  161.                 $this->msg = $this->tpl_msg[$template_lang . $template_file];  
  162.   
  163.                 return true;  
  164.         }  
  165.   
  166.         // assign variables  
  167.         function assign_vars($vars)  
  168.         {  
  169.                 $this->vars = (emptyempty($this->vars)) ? $vars : $this->vars . $vars;  
  170.         }  
  171.   
  172.         // Send the mail out to the recipients set previously in var $this->address  
  173.         function send()  
  174.         {  
  175.                 global $board_config$lang$phpEx$phpbb_root_path$db;  
  176.   
  177.             // Escape all quotes, else the eval will fail.  
  178.                 $this->msg = str_replace ("'""\'"$this->msg);  
  179.                 $this->msg = preg_replace('#\{([a-z0-9\-_]*?)\}#is'"' . $\\1 . '"$this->msg);  
  180.   
  181.                 // Set vars  
  182.                 reset ($this->vars);  
  183.                 while (list($key$val) = each($this->vars))  
  184.                 {  
  185.                         $$key = $val;  
  186.                 }  
  187.   
  188.                 eval("\$this->msg = '$this->msg';");  
  189.   
  190.                 // Clear vars  
  191.                 reset ($this->vars);  
  192.                 while (list($key$val) = each($this->vars))  
  193.                 {  
  194.                         unset($$key);  
  195.                 }  
  196.   
  197.                 // We now try and pull a subject from the email body ... if it exists,  
  198.                 // do this here because the subject may contain a variable  
  199.                 $drop_header = '';  
  200.                 $match = array();  
  201.                 if (preg_match('#^(Subject:(.*?))$#m'$this->msg, $match))  
  202.                 {  
  203.                         $this->subject = (trim($match[2]) != '') ? trim($match[2]) : (($this->subject != '') ? $this->subject : 'No Subject');  
  204.                         $drop_header .= '[\r\n]*?' . phpbb_preg_quote($match[1], '#');  
  205.                 }  
  206.                 else  
  207.                 {  
  208.                         $this->subject = (($this->subject != '') ? $this->subject : 'No Subject');  
  209.                 }  
  210.   
  211.                 if (preg_match('#^(Charset:(.*?))$#m'$this->msg, $match))  
  212.                 {  
  213.                         $this->encoding = (trim($match[2]) != '') ? trim($match[2]) : trim($lang['ENCODING']);  
  214.                         $drop_header .= '[\r\n]*?' . phpbb_preg_quote($match[1], '#');  
  215.                 }  
  216.                 else  
  217.                 {  
  218.                         $this->encoding = trim($lang['ENCODING']);  
  219.                 }  
  220.   
  221.                 if ($drop_header != '')  
  222.                 {  
  223.                         $this->msg = trim(preg_replace('#' . $drop_header . '#s'''$this->msg));  
  224.                 }  
  225.   
  226.         $to = $this->addresses['to'];  
  227.   
  228.         $cc = (count($this->addresses['cc'])) ? implode(', '$this->addresses['cc']) : '';  
  229.         $bcc = (count($this->addresses['bcc'])) ? implode(', '$this->addresses['bcc']) : '';  
  230.   
  231.         // Build header  
  232.         $this->extra_headers = (($this->reply_to != '') ? "Reply-to: $this->reply_to\n" : '') . (($this->from != '') ? "From: $this->from\n" : "From: " . $board_config['board_email'] . "\n") . "Return-Path: " . $board_config['board_email'] . "\nMessage-ID: <" . md5(uniqid(time())) . "@" . $board_config['server_name'] . ">\nMIME-Version: 1.0\nContent-type: text/plain; charset=" . $this->encoding . "\nContent-transfer-encoding: 8bit\nDate: " . date('r', time()) . "\nX-Priority: 3\nX-MSMail-Priority: Normal\nX-Mailer: PHP\nX-MimeOLE: Produced By phpBB2\n" . $this->extra_headers . (($cc != '') ? "Cc: $cc\n" : '')  . (($bcc != '') ? "Bcc: $bcc\n" : '');  
  233.   
  234.                 // Send message ... removed $this->encode() from subject for time being  
  235.                 if ( $this->use_smtp )  
  236.                 {  
  237.                         if ( !defined('SMTP_INCLUDED') )  
  238.                         {  
  239.                                 include('includes/smtp.' . $phpEx);  
  240.                         }  
  241.   
  242.                         $result = smtpmail($to$this->subject, $this->msg, $this->extra_headers);  
  243.                 }  
  244.                 else  
  245.                 {  
  246.             $empty_to_header = ($to == '') ? TRUE : FALSE;  
  247.             $to = ($to == '') ? (($board_config['sendmail_fix']) ? ' ' : 'Undisclosed-recipients:;') : $to;  
  248.                         $result = @mail($to$this->subject, preg_replace("#(?<!\r)\n#s""\n"$this->msg), $this->extra_headers);  
  249.   
  250.                         if (!$result && !$board_config['sendmail_fix'] && $empty_to_header)  
  251.                         {  
  252.                                 $to = ' ';  
  253.   
  254.                                 $sql = "UPDATE " . CONFIG_TABLE . "  
  255.                                         SET config_value = '1'  
  256.                                         WHERE config_name = 'sendmail_fix'";  
  257.                                 if (!$db->sql_query($sql))  
  258.                                 {  
  259.                                         message_die(GENERAL_ERROR, 'Unable to update config table'''__LINE____FILE__$sql);  
  260.                                 }  
  261.   
  262.                                 $board_config['sendmail_fix'] = 1;  
  263.                                 $result = @mail($to$this->subject, preg_replace("#(?<!\r)\n#s""\n"$this->msg), $this->extra_headers);  
  264.                         }  
  265.                 }  
  266.   
  267.                 // Did it work?  
  268.                 if (!$result)  
  269.                 {  
  270.                         message_die(GENERAL_ERROR, 'Failed sending email :: ' . (($this->use_smtp) ? 'SMTP' : 'PHP') . ' :: ' . $result''__LINE____FILE__);  
  271.                 }  
  272.   
  273.                 return true;  
  274.         }  
  275.   
  276.         // Encodes the given string for proper display for this encoding ... nabbed  
  277.         // from php.net and modified. There is an alternative encoding method which  
  278.         // may produce lesd output but it's questionable as to its worth in this  
  279.         // scenario IMO  
  280.         function encode($str)  
  281.         {  
  282.                 if ($this->encoding == '')  
  283.                 {  
  284.                         return $str;  
  285.                 }  
  286.   
  287.                 // define start delimimter, end delimiter and spacer  
  288.                 $end = "?=";  
  289.                 $start = "=?$this->encoding?B?";  
  290.                 $spacer = "$end\r\n $start";  
  291.   
  292.                 // determine length of encoded text within chunks and ensure length is even  
  293.                 $length = 75 - strlen($start) - strlen($end);  
  294.                 $length = floor($length / 2) * 2;  
  295.   
  296.                 // encode the string and split it into chunks with spacers after each chunk  
  297.                 $str = chunk_split(base64_encode($str), $length$spacer);  
  298.   
  299.                 // remove trailing spacer and add start and end delimiters  
  300.                 $str = preg_replace('#' . phpbb_preg_quote($spacer'#') . '$#'''$str);  
  301.   
  302.                 return $start . $str . $end;  
  303.         }  
  304.   
  305.         //  
  306.         // Attach files via MIME.  
  307.         //  
  308.         function attachFile($filename$mimetype = "application/octet-stream"$szFromAddress$szFilenameToDisplay)  
  309.         {  
  310.                 global $lang;  
  311.                 $mime_boundary = "--==================_846811060==_";  
  312.   
  313.                 $this->msg = '--' . $mime_boundary . "\nContent-Type: text/plain;\n\tcharset=\"" . $lang['ENCODING'] . "\"\n\n" . $this->msg;  
  314.   
  315.                 if ($mime_filename)  
  316.                 {  
  317.                         $filename = $mime_filename;  
  318.                         $encoded = $this->encode_file($filename);  
  319.                 }  
  320.   
  321.                 $fd = fopen($filename"r");  
  322.                 $contents = fread($fdfilesize($filename));  
  323.   
  324.                 $this->mimeOut = "--" . $mime_boundary . "\n";  
  325.                 $this->mimeOut .= "Content-Type: " . $mimetype . ";\n\tname=\"$szFilenameToDisplay\"\n";  
  326.                 $this->mimeOut .= "Content-Transfer-Encoding: quoted-printable\n";  
  327.                 $this->mimeOut .= "Content-Disposition: attachment;\n\tfilename=\"$szFilenameToDisplay\"\n\n";  
  328.   
  329.                 if ( $mimetype == "message/rfc822" )  
  330.                 {  
  331.                         $this->mimeOut .= "From: ".$szFromAddress."\n";  
  332.                         $this->mimeOut .= "To: ".$this->emailAddress."\n";  
  333.                         $this->mimeOut .= "Date: ".date("D, d M Y H:i:s") . " UT\n";  
  334.                         $this->mimeOut .= "Reply-To:".$szFromAddress."\n";  
  335.                         $this->mimeOut .= "Subject: ".$this->mailSubject."\n";  
  336.                         $this->mimeOut .= "X-Mailer: PHP/".phpversion()."\n";  
  337.                         $this->mimeOut .= "MIME-Version: 1.0\n";  
  338.                 }  
  339.   
  340.                 $this->mimeOut .= $contents."\n";  
  341.                 $this->mimeOut .= "--" . $mime_boundary . "--" . "\n";  
  342.   
  343.                 return $out;  
  344.                 // added -- to notify email client attachment is done  
  345.         }  
  346.   
  347.         function getMimeHeaders($filename$mime_filename="")  
  348.         {  
  349.                 $mime_boundary = "--==================_846811060==_";  
  350.   
  351.                 if ($mime_filename)  
  352.                 {  
  353.                         $filename = $mime_filename;  
  354.                 }  
  355.   
  356.                 $out = "MIME-Version: 1.0\n";  
  357.                 $out .= "Content-Type: multipart/mixed;\n\tboundary=\"$mime_boundary\"\n\n";  
  358.                 $out .= "This message is in MIME format. Since your mail reader does not understand\n";  
  359.                 $out .= "this format, some or all of this message may not be legible.";  
  360.   
  361.                 return $out;  
  362.         }  
  363.   
  364.         //  
  365.    // Split string by RFC 2045 semantics (76 chars per line, end with \r\n).  
  366.         //  
  367.         function myChunkSplit($str)  
  368.         {  
  369.                 $stmp = $str;  
  370.                 $len = strlen($stmp);  
  371.                 $out = "";  
  372.   
  373.                 while ($len > 0)  
  374.                 {  
  375.                         if ($len >= 76)  
  376.                         {  
  377.                                 $out .= substr($stmp, 0, 76) . "\r\n";  
  378.                                 $stmp = substr($stmp, 76);  
  379.                                 $len = $len - 76;  
  380.                         }  
  381.                         else  
  382.                         {  
  383.                                 $out .= $stmp . "\r\n";  
  384.                                 $stmp = "";  
  385.                                 $len = 0;  
  386.                         }  
  387.                 }  
  388.                 return $out;  
  389.         }  
  390.   
  391.         //  
  392.    // Split the specified file up into a string and return it  
  393.         //  
  394.         function encode_file($sourcefile)  
  395.         {  
  396.                 if (is_readable(phpbb_realpath($sourcefile)))  
  397.                 {  
  398.                         $fd = fopen($sourcefile"r");  
  399.                         $contents = fread($fdfilesize($sourcefile));  
  400.               $encoded = $this->myChunkSplit(base64_encode($contents));  
  401.               fclose($fd);  
  402.                 }  
  403.   
  404.                 return $encoded;  
  405.         }  
  406.   
  407. // class emailer  
  408.   
  409. ?>  
Előre is köszi!
Rusty
7

mail() FreeWeben

s_volenszki · 2006. Jún. 15. (Cs), 10.26
Bocsi, de én nemmászok bele a kódodba, de azt bizton állíthatom, hogy a fw-en én is elég sokat gyötrődtem mire megszültem a helyes megoldást! Jelen tudásom szerint, text/html levelet lehet küldeni (nekem nem müködött az inline objektum hozzáadása), követeli a header-ben a x-FW-MailID-t, és nem engedi az extra headers-t!

Többnyire kapcsolatfelvételre kérnek ilyen rutint (ne az Outlook ugráljon, ha valaki üzenetet akar küldeni), én már régóta használom ezt:
  1. $to .= "email##kukac##cim.hu";   
  2. $subject = "E-mail mail()-el.";   
  3. $headers .= "From: Én vagyok a feladó <felado##kukac##emailcim.hu>\n";   
  4. $headers .= "Content-Type: text/html; charset=iso-8859-1\n";   
  5. $headers .= "X-FW-MailID: 309db6aa5f\n";  
  6. $message = " <p>Ide jöhet a <b>szöveg</b>, és más html tartalom, akár egy komplett html oldal!</p>  
  7.   
  8. mail($to$subject$message$headers);  
s_volenszki
9

hááát

Anonymous · 2006. Jún. 15. (Cs), 23.00
A gond csak az,h ez php-nuke és én nem értek annyira php-hez hogy átírjam a php-nuke ezen részét vagy ezt hogyan írjam bele... Azért köszi!
Rusty
10

FreeWeb

s_volenszki · 2006. Jún. 16. (P), 13.16
Akkor lehet hogy kellene választanod egy tárhelyet!

FW => Minimális szolgáltatás => Tudás
Fizetős tárhely => Maximális szolgáltatás => Minimális tudás

s_volenszki
11

választottam

Anonymous · 2006. Jún. 18. (V), 21.19
fw-t, ott nem sikerült helyesen beállítanom! Ehhez kértem segítséget, mint az előttem lévők és ezért mésoltam be az eredeti kódot. Hibaüzit meg nem kapok, így nem tudok min elindulni

Rusty
12

freeweb

Anonymous · 2006. Júl. 20. (Cs), 18.35
Miért is használ valaki freewebet mikor néhány ezer forintért rendes tárhelyet lehet használni minden funkcióval????