[TYPO3] Re: [Typo3] How to get Direct Mail to NOT attach images - resolved

Andre Flitsch pixelhed at pixel-works.co.uk
Wed Mar 8 08:57:16 CET 2006


rodrigo cea wrote:
> Dearest list,
> 
> is there way to get the direct mail extension to not attach images, that 
> is leave their src pointing to the actual site?
> Looking through the archives, Pieter Jelle had the same issue and solved 
> it, but didn't explain how:
> 
> http://typo3.org/documentation/mailing-lists/dev-list-archive/thread/110136379/?tx_maillisttofaq_pi1%5Bpointer%5D=10&tx_maillisttofaq_pi1%5Bmode%5D=1 
> 
> 
> Thanks,
Hi I don't know if you are still looking for this answer, but i have it.

In order to get the html mail sent with no images attached, and for the 
source code to link to the actual images on the site, i had to change 2 
files.

file: /typo3_src/t3lib/class.t3ib_htmlmail.php
line: 336

changed:
$this->substMediaNamesInHTML(0);	// 0 = relative

to:
$this->substMediaNamesInHTML(1);	// 0 = relative

This makes the images reference those on the server.

Now i also have the extension (kb_mailcs) installed which extends 
/typo3_src/t3lib/class.t3lib_dmailer.php, so i made my changes there. 
you could also change the original file, if you do not have this 
extension installed.

my changes:
file: /typo3conf/ext/kb_mailcs/class.ux_t3ib_dmailer.php
function: dmailer_prepare

i changed this:
$this->dmailer['sys_dmail_rec'] = $row;

$this->dmailer['boundaryParts_html'] = 
explode($this->dmailer['sectionBoundary'], 
'_END-->'.$this->dmailer['html_content']);
while(list($bKey,$bContent)=each($this->dmailer['boundaryParts_html']))	{
	$this->dmailer['boundaryParts_html'][$bKey] = explode('-->',$bContent,2);
				// Now, analyzing which media files are used in this part of the mail:
			$mediaParts = 
explode('cid:part',$this->dmailer['boundaryParts_html'][$bKey][1]);
			reset($mediaParts);
			next($mediaParts);
			while(list(,$part)=each($mediaParts))	{
			 
$this->dmailer['boundaryParts_html'][$bKey]['mediaList'].=','.strtok($part,'.');
			}
}

to this:
$this->dmailer['sys_dmail_rec'] = $row;

// remove the media parts
unset($this->theParts['html']['media']);

$this->dmailer['boundaryParts_html'] = 
explode($this->dmailer['sectionBoundary'], 
'_END-->'.$this->dmailer['html_content']);
while(list($bKey,$bContent)=each($this->dmailer['boundaryParts_html']))	{
	$this->dmailer['boundaryParts_html'][$bKey] = explode('-->',$bContent,2);
//				// Now, analyzing which media files are used in this part of the mail:
//			$mediaParts = 
explode('cid:part',$this->dmailer['boundaryParts_html'][$bKey][1]);
//			reset($mediaParts);
//			next($mediaParts);
//			while(list(,$part)=each($mediaParts))	{
//			 
$this->dmailer['boundaryParts_html'][$bKey]['mediaList'].=','.strtok($part,'.');
//			}
}

Like i said if you do not have the extension kb_mailcs installed you can 
  make the changes in the same function in 
/typo3_src/t3lib/class.t3lib_dmailer.php

Now the email is sent without attached images, and with paths that 
reference files on the server.

I hope that this helps someone.

Andre



More information about the TYPO3-english mailing list