Changeset 2295
- Timestamp:
- 03/18/10 15:14:48 (14 years ago)
- Location:
- trunk/expressoMail1_2/inc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/inc/class.phpmailer.php
r1793 r2295 670 670 } 671 671 else 672 673 $smtpSent = $this->smtp->Data($header .$body);674 672 { 673 $smtpSent = $this->smtp->Data($header.$body); 674 } 675 675 676 676 if(!$smtpSent) … … 712 712 $header = substr($header, 0, $target) . $this->AddrAppend("Bcc", $this->bcc) . substr($header, $target); 713 713 } 714 $new_headerx = str_replace(chr(0x0A),chr(0x0D).chr(0x0A), $header);715 $ new_bodyx = str_replace(chr(0x0A),chr(0x0D).chr(0x0A), $body);716 $ new_header = str_replace(chr(0x0D).chr(0x0D).chr(0x0A), chr(0x0D).chr(0x0A),$new_headerx);717 $ new_body = str_replace(chr(0x0D).chr(0x0D).chr(0x0A), chr(0x0D).chr(0x0A), $new_bodyx);714 $header = str_replace("\n","\r\n", $header); 715 $header = str_replace("\r\r\n","\r\n",$header); 716 $body = str_replace("\n","\r\n", $body); 717 $body = str_replace("\r\r\n","\r\n",$body); 718 718 719 719 if ($this->SaveMessageAsDraft){ 720 imap_append($mbox_stream, "{".$imap_server.":".$imap_port."}".$this->SaveMessageInFolder, $ new_header . $new_body, "\\Seen \\Draft");720 imap_append($mbox_stream, "{".$imap_server.":".$imap_port."}".$this->SaveMessageInFolder, $header.$body, "\\Seen \\Draft"); 721 721 return true; 722 722 } 723 723 else 724 imap_append($mbox_stream, "{".$imap_server.":".$imap_port."}".$this->SaveMessageInFolder, $ new_header . $new_body, "\\Seen");724 imap_append($mbox_stream, "{".$imap_server.":".$imap_port."}".$this->SaveMessageInFolder, $header.$body, "\\Seen"); 725 725 } 726 726 … … 731 731 { 732 732 $mail_retorno = FALSE; 733 if ((strlen($email) >= 6) && (substr_count($email,"@") == 1) && (substr($email,0,1) != "@") && (substr($email,strlen($email)-1,1) != "@"))733 if ((strlen($email) >= 2) && (substr_count($email,"@") == 1) && (substr($email,0,1) != "@") && (substr($email,strlen($email)-1,1) != "@")) 734 734 { 735 735 if ((!strstr($email,"'")) && (!strstr($email,"\"")) && (!strstr($email,"\\")) && (!strstr($email,"\$")) && (!strstr($email," "))) … … 741 741 $term_dom = substr(strrchr ($email, '.'),1); 742 742 //verifica se terminação do dominio esta correcta 743 if (strlen($term_dom)>1 && strlen($term_dom)< 5&& (!strstr($term_dom,"@")) )743 if (strlen($term_dom)>1 && strlen($term_dom)<9 && (!strstr($term_dom,"@")) ) 744 744 { 745 745 $antes_dom = substr($email,0,strlen($email) - strlen($term_dom) - 1); … … 1331 1331 } 1332 1332 else 1333 { 1334 $mime[] = $this->EncodeFile($path, $encoding); 1333 { 1334 $filename = $this->EncodeFile($path, $encoding); 1335 $handle = fopen($filename,'r'); 1336 $mime[] = fread($handle, filesize($filename));; 1335 1337 if($this->IsError()) { return ""; } 1336 1338 $mime[] = $this->LE.$this->LE; … … 1344 1346 1345 1347 /** 1346 * Encodes attachment in requested format. Returns an1347 * empty stringon failure.1348 * Encodes attachment in requested format. Returns 1349 * path os encoded file or null on failure. 1348 1350 * @access private 1349 1351 * @return string 1350 1352 */ 1351 1353 function EncodeFile ($path, $encoding = "base64") { 1352 if(!@$f d= fopen($path, "rb"))1354 if(!@$fh = fopen($path, "rb")) 1353 1355 { 1354 1356 $this->SetError($this->Lang("file_open") . $path); 1355 return "";1357 return null; 1356 1358 } 1357 1359 $magic_quotes = get_magic_quotes_runtime(); 1358 set_magic_quotes_runtime(0); 1359 $file_buffer = fread($fd, filesize($path)); 1360 $file_buffer = $this->EncodeString($file_buffer, $encoding); 1361 fclose($fd); 1362 set_magic_quotes_runtime($magic_quotes); 1363 1364 return $file_buffer; 1360 set_magic_quotes_runtime(0); 1361 1362 $nameOut = ini_get("session.save_path").'/'."email_".$_SESSION[ 'phpgw_session' ][ 'session_id' ].".base64"; 1363 $fh2 = fopen($nameOut, 'wb'); 1364 if ($encoding != 'base64') 1365 { 1366 return false; 1367 $file_buffer = fread($fh, filesize($path)); 1368 $file_buffer = $this->EncodeString($file_buffer, $encoding); 1369 fwrite($fh2, $file_buffer); 1370 } 1371 else 1372 { 1373 1374 $cache = ''; 1375 $eof = false; 1376 1377 while (1) { 1378 if (!$eof) { 1379 if (!feof($fh)) { 1380 $row = fgets($fh, 4096); 1381 } else { 1382 $row = ''; 1383 $eof = true; 1384 } 1385 } 1386 1387 if ($cache !== '') 1388 $row = $cache.$row; 1389 elseif ($eof) 1390 break; 1391 1392 $b64 = base64_encode($row); 1393 $put = ''; 1394 1395 if (strlen($b64) < 76) { 1396 if ($eof) { 1397 $put = $b64."\n"; 1398 $cache = ''; 1399 } else { 1400 $cache = $row; 1401 } 1402 1403 } elseif (strlen($b64) > 76) { 1404 do { 1405 $put .= substr($b64, 0, 76)."\n"; 1406 $b64 = substr($b64, 76); 1407 } while (strlen($b64) > 76); 1408 1409 $cache = base64_decode($b64); 1410 1411 } else { 1412 if (!$eof && $b64{75} == '=') { 1413 $cache = $row; 1414 } else { 1415 $put = $b64."\n"; 1416 $cache = ''; 1417 } 1418 } 1419 1420 if ($put !== '') 1421 fputs($fh2, $put); 1422 } 1423 } 1424 fclose($fh2); 1425 fclose($fh); 1426 1427 set_magic_quotes_runtime($magic_quotes); 1428 1429 return $nameOut; 1430 //return $file_buffer; 1365 1431 } 1366 1432 -
trunk/expressoMail1_2/inc/class.smtp.php
r1059 r2295 307 307 $msg_data = str_replace("\r\n","\n",$msg_data); 308 308 $msg_data = str_replace("\r","\n",$msg_data); 309 $lines = explode("\n",$msg_data);309 $lines = preg_split("/\n/",$msg_data); 310 310 311 311 # we need to find a good way to determine is headers are
Note: See TracChangeset
for help on using the changeset viewer.