jamesiarmes / php-ews

PHP Exchange Web Services
http://jamesarmes.com/php-ews/
MIT License
566 stars 303 forks source link

Display email signature images #381

Open ManiMuridi opened 7 years ago

ManiMuridi commented 7 years ago

Version (e.g. 1.0, dev-master): dev-master

Microsoft Exchange version: 2007,2013

Description of problem: How can I display the image of an email signature I've received from a sender? signature

jamesiarmes commented 7 years ago

I haven't verified, but I would expect there to be an attachment on the message for the inline image. You would then need to use a GetAttachment operation to download the file.

ManiMuridi commented 7 years ago

There is an attachment on the message and I did use the GetAttachment but when I download I have to change the url of the image in the message to display it properly on my email client. But does this mean that I have to resend that attachment using the original image src url that exchange created or can I just send it as an attachment again? I'll test it now but I wasn't sure if you worked in this section yet. I would love to contribute to this project as well so I will find some time soon for sure.

jamesiarmes commented 7 years ago

I'm not sure I understand your question. Are you asking if you need to re-attach the image in a reply that would include the original signature?

ManiMuridi commented 7 years ago

Basically, suppose I receive an email and there is a signature in the email which contains an image. The image doesn't display properly since its src url looks like <img src="cid:image0001.png)ED100...."> if I were to use the GetAttachement()function I can get the image but once I download the image in the signature I need to tell the <img src="cid:image0001.pngED100.." /> in the html message body signature to be <img src="path/to/the/image" /> correct?

However, if I do that...when I reply to the message the img src is the src that I changed it to (src="path/to/my/image") now does this mean I need to attache that image again in order for the image to display properly on other email clients?

simply put, my email client is web based and I am display the message body in an iframe, I need the message to display properly with the signatures and their images.

Thanks so much for your help I really appreciate it.

jamesiarmes commented 7 years ago

If you are including the same signature in the body of the new message, then I believe you would need to attach the the image to the new message. Depending on your server/user settings, replying may automatically include the quoted email message, so including the original signature from the sender may not be necessary. I have never actually tried this, so I unfortunately can't verify, this is just a best guess.

erikegon commented 7 years ago

I have never been able to forward or reply to a message using the appropriate functions. Somehow the message is either not sent or delivers an empty message. So my workaround is to re-attach all inline and file attachments to a new message and copy the old body underneath the reply/forward text and use str_replace() to change/reformat the img-tags to reflect the format Exchange expects.

When I receive new messages I create an attachment-folder on the webserver equal to md5(ItemId->Id) and copy the attachments to that location. When replying the attachments can be easily found by listing all files in that folder.

Took some time to work it all out, but it does work.

jamesiarmes commented 7 years ago

Have you tried the message/reply-all example? You shouldn't have to create a completely new message for a reply and doing so will result in Exchange and other email clients from not recognizing the message as being a reply.