Changeset 6259
- Timestamp:
- 05/21/12 17:17:16 (12 years ago)
- Location:
- sandbox/2.4.1-2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/2.4.1-2/expressoMail1_2/inc/class.imap_functions.inc.php
r6212 r6259 3074 3074 */ 3075 3075 //////////////////////////////////////////////////////////////////////////////////////////////////// 3076 3076 3077 $this->rfc2397ToEmbeddedAttachment($mailService , $body); 3078 3077 3079 if ($isHTML) 3078 3080 $mailService->setBodyHtml($body); … … 5271 5273 return $ret; 5272 5274 } 5275 5276 /** 5277 * Método que convert imagens no formato rfc2397 para Embedded Attachment 5278 * 5279 * @license http://www.gnu.org/copyleft/gpl.html GPL 5280 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 5281 * @sponsor Caixa Econômica Federal 5282 * @author Cristiano Corrêa Schmidt 5283 * @param <MailService> <$mailService> <Referencia objeto MailService> 5284 * @param <String> <$body> <Referencia Corpo do email> 5285 * @return <void> 5286 * @access <public> 5287 */ 5288 function rfc2397ToEmbeddedAttachment( &$mailService , &$body ) 5289 { 5290 $matches = array(); 5291 preg_match_all("/src=[\'|\"]+data:([^;]*)(.*);base64,([a-zA-Z0-9\+\/\=]+)[\'|\"]+/i", $body, $matches, PREG_SET_ORDER); //Resgata imagens em rfc2397 5292 5293 foreach ($matches as $i => &$v) 5294 { 5295 $mailService->addStringImage(base64_decode($v[3]), $v[1] , 'EmbeddedImage'.$i.'.'.$this->mimeToExtension($v[1])); 5296 $body = str_replace($v[0], 'src="EmbeddedImage'.$i.'.'.$this->mimeToExtension($v[1]).'"' , $body); 5297 } 5298 } 5299 5300 /** 5301 * Método que retorna a extensão do arquivo atraves do mime type 5302 * 5303 * @license http://www.gnu.org/copyleft/gpl.html GPL 5304 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 5305 * @sponsor Caixa Econômica Federal 5306 * @author Cristiano Corrêa Schmidt 5307 * @param <String> <$mimeType> <Mime Type do arquivo> 5308 * @return <String> <extensão> 5309 * @access <public> 5310 */ 5311 function mimeToExtension($mimeType) 5312 { 5313 switch ( $mimeType ) 5314 { 5315 case 'image/bmp' : 5316 return 'bmp'; 5317 case 'image/cgm' : 5318 return 'cgm'; 5319 case 'image/vnd.djvu' : 5320 return 'djv'; 5321 case 'image/gif' : 5322 return 'gif'; 5323 case 'image/x-icon' : 5324 return 'ico'; 5325 case 'image/ief' : 5326 return 'ief'; 5327 case 'image/jpeg' : 5328 return 'jpg'; 5329 case 'image/x-macpaint' : 5330 return 'mac'; 5331 case 'image/pict' : 5332 return 'pct'; 5333 case 'image/png' : 5334 return 'png'; 5335 case 'image/x-quicktime' : 5336 return 'qti'; 5337 case 'image/x-rgb' : 5338 return 'rgb'; 5339 case 'image/tiff' : 5340 return 'tif'; 5341 default: 5342 return ''; 5343 } 5344 5345 } 5346 5347 5273 5348 } 5274 5349 ?> -
sandbox/2.4.1-2/prototype/services/ImapServiceAdapter.php
r6212 r6259 605 605 if(isset($data['input_return_receipt'])) 606 606 $mailService->addHeaderField('Disposition-Notification-To', Config::me('mail')); 607 607 608 $this->rfc2397ToEmbeddedAttachment($mailService , $body); 609 608 610 $isHTML = ( isset($data['type']) && $data['type'] == 'html' )? true : false; 609 611
Note: See TracChangeset
for help on using the changeset viewer.