[Frontaccounting-cvs_updates] frontaccount/reporting/includes class.mail.inc, 1.2.2.2, 1.2.2.3
Brought to you by:
frontaccounting,
itronics
From: itronics <itr...@us...> - 2010-10-28 09:29:35
|
Update of /cvsroot/frontaccounting/frontaccount/reporting/includes In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv20469/reporting/includes Modified Files: Tag: unstable class.mail.inc Log Message: Fixed mailing problems under php with suhohin patch. Index: class.mail.inc =================================================================== RCS file: /cvsroot/frontaccounting/frontaccount/reporting/includes/class.mail.inc,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -C2 -d -r1.2.2.2 -r1.2.2.3 *** class.mail.inc 11 May 2010 11:32:07 -0000 1.2.2.2 --- class.mail.inc 28 Oct 2010 09:29:27 -0000 1.2.2.3 *************** *** 10,13 **** --- 10,28 ---- Leave this header in this file! + ------------------------------------------------------------------ + Updated: 2010-10-25 + Updated by: Michael Hahn (MPH) + + Problem: The Suhosin patch for PHP was blocking the email before it ever reached + the email server due to double line feeds (\n) in the header of the email. + Also, the body of the message was included in the header. This would also + trip the security measure everytime it spotted a double line feed. + Fix: Remove any double line feed from the header info and seperate the body of + the message from the header. + Other updates: I'm not sure about RFC compliance but, every other email I've look at had + certain information included in double quotes. More than likely to avoid + erroneous file naming. I tried to emulate this mindset. + Added line length and EOL char for file chunking. For some reason without + it there were extra line feeds in the chunked file. */ *************** *** 27,31 **** { $this->boundary = md5(uniqid(time())); ! $this->header .= "From: $name <$mail>\n"; } --- 42,46 ---- { $this->boundary = md5(uniqid(time())); ! $this->header = "From: $name <$mail>\n"; } *************** *** 57,62 **** function text($text) { ! $this->body = "Content-Type: text/plain; charset={$this->charset}\n"; ! $this->body .= "Content-Transfer-Encoding: 8bit\n\n"; $this->body .= $text."\n"; } --- 72,77 ---- function text($text) { ! $this->body = "Content-Type: text/plain; charset=\"{$this->charset}\"\n"; ! $this->body .= "Content-Transfer-Encoding: 8bit\n"; $this->body .= $text."\n"; } *************** *** 64,69 **** function html($html) { ! $this->body = "Content-Type: text/html; charset={$this->charset}\n"; ! $this->body .= "Content-Transfer-Encoding: quoted-printable\n\n"; $this->body .= "<html><body>\n".$html."\n</body></html>\n"; } --- 79,84 ---- function html($html) { ! $this->body = "Content-Type: text/html; charset=\"{$this->charset}\"\n"; ! $this->body .= "Content-Transfer-Encoding: quoted-printable\n"; $this->body .= "<html><body>\n".$html."\n</body></html>\n"; } *************** *** 112,120 **** $this->header .= "\n"; } ! $this->header .= "MIME-Version: 1.0\n"; ! $this->header .= "Content-Type: multipart/mixed; boundary=$this->boundary\n\n"; ! $this->header .= "This is a multi-part message in MIME format\n"; $this->header .= "--$this->boundary\n"; ! $this->header .= $this->body; // Attachment hinzufügen --- 127,135 ---- $this->header .= "\n"; } ! $this->header .= "MIME-Version: 1.0\n"; ! $this->header .= "Content-Type: multipart/mixed;\n boundary=\"$this->boundary\"\n"; ! $this->header .= "This is a multi-part message in MIME format.\n"; $this->header .= "--$this->boundary\n"; ! $this->header .= $this->content_type; // Attachment hinzufügen *************** *** 125,141 **** { $file = fread(fopen($this->attachment[$i], "r"), filesize($this->attachment[$i])); ! $this->header .= "--".$this->boundary."\n"; ! $this->header .= "Content-Type: " .$this->mime_type(basename($this->attachment[$i])). "; name=".basename($this->attachment[$i])."\n"; ! $this->header .= "Content-Transfer-Encoding: base64\n"; ! $this->header .= "Content-Disposition: attachment; filename=".basename($this->attachment[$i])."\n\n"; ! $this->header .= chunk_split(base64_encode($file))."\n"; $file = ""; } } ! $this->header .= "--".$this->boundary."--\n\n"; foreach($this->to as $mail) { ! $ret = mail($mail, $this->subject, "", $this->header); } return $ret; --- 140,156 ---- { $file = fread(fopen($this->attachment[$i], "r"), filesize($this->attachment[$i])); ! $this->body .= "--".$this->boundary."\n"; ! $this->body .= "Content-Type: " .$this->mime_type(basename($this->attachment[$i])). "; name=\"".basename($this->attachment[$i])."\"\n"; ! $this->body .= "Content-Transfer-Encoding: base64\n"; ! $this->body .= "Content-Disposition: attachment; filename=\"".basename($this->attachment[$i])."\"\n\n"; ! $this->body .= chunk_split(base64_encode($file),"72","\n"); $file = ""; } } ! $this->body .= "--".$this->boundary."--\n"; foreach($this->to as $mail) { ! $ret = mail($mail, $this->subject, $this->body, $this->header); } return $ret; |