PDA

View Full Version : Email: Capture embedded OLE images


davidiwharper
01-25-2008, 02:23 AM
Does anybody know whether it is possible to capture embedded (OLE) images when importing an email message sent from Microsoft Outlook into osTicket?

If this were possible, the sender could simply paste a screenshot of her error (or whatever) into an email. Without this feature, she has to to save the image separately and then attach it to their message.

IanBrooks
09-12-2008, 09:39 AM
I'm looking for an answer to this too, as users keep sending emails with embedded images, and I have to keep asking them to resend their emails with the images attached instead, and it's not building huge confidence in out ticket system :(

If anyone knows a way to do this, or can at least point me in the right direction, it would be hugely appreciated!

mmmichael
09-25-2008, 11:31 PM
Hi,

a small test with my theBat and the following Code-Change saves inline Attachments:

class.php3.php:

//Save attachments if any.
if($msgid && $cfg->allowEmailAttachments()){
mail('mb@blmedia', 'Ticketsystem - Attachments', print_r($struct, true));
if(($struct = imap_fetchstructure($this->mbox,$mid)) && $struct->parts) {
//We've got something...do a search
foreach($struct->parts as $k=>$part) {
$filename = '';
if($part && $part->ifdparameters && ($filename=$part->dparameters[0]->value)){ //attachment
if($cfg->canUploadFileType($filename) && $cfg->getMaxFileSize()>=$part->bytes) {
//extract the attachments...and do the magic.
$data=$this->decode($part->encoding, imap_fetchbody($this->mbox,$mid,$k+1));
$ticket->saveAttachment($filename,$data,$msgid,'M');
}
}

if($part && $part->ifparameters && $filename!=$part->parameters[0]->value && ($filename=$part->parameters[0]->value)){ //attachment
if($cfg->canUploadFileType($filename) && $cfg->getMaxFileSize()>=$part->bytes) {
//extract the attachments...and do the magic.
$data=$this->decode($part->encoding, imap_fetchbody($this->mbox,$mid,$k+1));
$ticket->saveAttachment($filename,$data,$msgid,'M');
}
}
}
}
}



Michael

Roeshead
10-25-2008, 02:14 PM
MMMichael,

Thanks for the code. Worked well for me. I did comment out the line:
mail('mb@blmedia', 'Ticketsystem - Attachments', print_r($struct, true));


As I wasn't really sure what that did and it seems to work without it.

mihamil
12-11-2008, 08:04 PM
I have made the changes listed above and I still cannot receive screenshots into OSticket. Here is my class.pop3.php file. I included a few lines before and after. Is there any specific attachment settings that must be changed in the admin panel.
:confused:

}else{
$message=$var['message'];
//Strip quoted reply...TODO: figure out how mail clients do it without special tag..
if($cfg->stripQuotedReply() && ($tag=$cfg->getReplySeparator()) && strpos($var['message'],$tag))
list($message)=split($tag,$var['message']);
$msgid=$ticket->postMessage($message,$var['header'],'Email');
}
//Save attachments if any.
if($msgid && $cfg->allowEmailAttachments()){
mail('mb@blmedia', 'Ticketsystem - Attachments', print_r($struct, true));
if(($struct = imap_fetchstructure($this->mbox,$mid)) && $struct->parts) {
//We've got something...do a search
foreach($struct->parts as $k=>$part) {
$filename = '';
if($part && $part->ifdparameters && ($filename=$part->dparameters[0]->value)){ //attachment
if($cfg->canUploadFileType($filename) && $cfg->getMaxFileSize()>=$part->bytes) {
//extract the attachments...and do the magic.
$data=$this->decode($part->encoding, imap_fetchbody($this->mbox,$mid,$k+1));
$ticket->saveAttachment($filename,$data,$msgid,'M');
}
}
if($part && $part->ifparameters && $filename!=$part->parameters[0]->value && ($filename=$part->parameters[0]->value)){ //attachment
if($cfg->canUploadFileType($filename) && $cfg->getMaxFileSize()>=$part->bytes) {
//extract the attachments...and do the magic.
$data=$this->decode($part->encoding, imap_fetchbody($this->mbox,$mid,$k+1));
$ticket->saveAttachment($filename,$data,$msgid,'M');
}
}
}
}
}
return $ticket;
}

function fetchTickets($emailid,$max=20,$deletemsgs=false){