justaphase
asked on
FoxPro send email Outlook.Application with signature
Hi Experts,
I've been struggling allot with this..
I have a foxpro code that works fine opening a new outlook email and attaching a file and everything, the problem stands with the signature.
I tried to get the original html that Outlook.Application generates in the html body of the email with the signature and add some text to it (since the problem is when we set the .BodyHtml, the signature that is set by default is overwritten), but scrambles everything and i don't know why.
So googling it, i've found out that the best way is to get signature in the appdata system folder witch is in html, rtf and txt format and add it to the html body of the email.
the problem is that the images of the signature aren't embedded (doesn't show them, appears a box saying that the image can't be displayed) and when i try to send the email, Outlook doesn't let me saying "Could not complete the operation, One or more parameter values are not valid".
What am i doing wrong?
Please help me.
My code:
I've been struggling allot with this..
I have a foxpro code that works fine opening a new outlook email and attaching a file and everything, the problem stands with the signature.
I tried to get the original html that Outlook.Application generates in the html body of the email with the signature and add some text to it (since the problem is when we set the .BodyHtml, the signature that is set by default is overwritten), but scrambles everything and i don't know why.
So googling it, i've found out that the best way is to get signature in the appdata system folder witch is in html, rtf and txt format and add it to the html body of the email.
the problem is that the images of the signature aren't embedded (doesn't show them, appears a box saying that the image can't be displayed) and when i try to send the email, Outlook doesn't let me saying "Could not complete the operation, One or more parameter values are not valid".
What am i doing wrong?
Please help me.
My code:
PROCEDURE EnviaEmailBOCl
LPARAMETERS EmailCl, Assunto, Texto, Ficheiro
LOCAL EnviaOk
EnviaOk = .t.
IF EnviaOk
#DEFINE MAILITEM 0
#DEFINE IMPORTANCELOW 0
#DEFINE IMPORTANCENORMAL 1
#DEFINE IMPORTANCEHIGH 2
oOutLookObject = CreateObject("Outlook.Application")
oEmailItem = oOutLookObject.CreateItem(MAILITEM)
oOutLookObject = oEmailItem.GetInspector
ADIR(aHtmSig,GETENV("APPDATA")+"\Microsoft\Signatures\*.htm")
xfile = GETENV("APPDATA")+"\Microsoft\Signatures\"+aHtmSig(1,1)
x= FILETOSTR(xfile)
WITH oEmailItem
.Recipients.Add(EmailCL) && uses the Recipients collection
&&.CC="assistente@acidados.pt"
.Subject = Assunto
.Importance = IMPORTANCENORMAL
**.Display()
.HtmlBody = "Adding text!!<br>" + x
.Attachments.Add(Ficheiro) && Note that the fully qualified path and file is required.
**.Send
.Display
ENDWITH
RELEASE oEmailItem
RELEASE oOutLookObject
ENDIF
ENDPROC
Your statement
.HtmlBody = "Adding text!!<br>" + x
does not add "something" to your HTML message body but it overwrites it completely.
Even the fillowing command should not work correctly:
.HtmlBody = "Adding text!!<br>" + x + .HtmlBody
You have to find appropriate place in HTMLBody and insert your new HTML contents into this place.
.HtmlBody = "Adding text!!<br>" + x
does not add "something" to your HTML message body but it overwrites it completely.
Even the fillowing command should not work correctly:
.HtmlBody = "Adding text!!<br>" + x + .HtmlBody
You have to find appropriate place in HTMLBody and insert your new HTML contents into this place.
Yes, pavel is right. The usual place for new HTML parts before the HTML signature is directly after the <body> tag, as the body of html begins there.
The signature only is added, if you Display a mail item. For a start, simply pull out the HTML Body of a mailitem right after .Display() of it, save that whole text to a sig.html file and edit it with an HTML editor to save as mail.html. Then compare sig.html to mail.html and you will find out where to merge what. You won't need any HTML knowledge to do that. You seem to lack that.
Bye, Olaf.
The signature only is added, if you Display a mail item. For a start, simply pull out the HTML Body of a mailitem right after .Display() of it, save that whole text to a sig.html file and edit it with an HTML editor to save as mail.html. Then compare sig.html to mail.html and you will find out where to merge what. You won't need any HTML knowledge to do that. You seem to lack that.
Bye, Olaf.
ASKER
Hello friends,
Ok, so let's see.
@jrbbldr:
I know the images are not embedded as i told you, and i know they have to be. but that's why i asked my friend, i don't know "how to" in foxpro. i'm a php developer for example, and in that case i would not have any problem, but in foxpro i have :)
@pcelba:
You say that my HTML message is overwritten completely. Well, what message? You mean the signature that Outlook creates by default at beginning of the message?
As i said in my comment "(since the problem is when we set the .BodyHtml, the signature that is set by default is overwritten)", i already told that, i know that.
That's why wrote in my code "Adding text!!<br>" + x, meaning that is some text and variable "x", that variable is the signature..makes some sense i guess but doesn't work.
@Olaf_Doschke:
I already tried that. Add the text after the .Display, but didn't work as well (but will try again, just in case Olaf).
As for you say that i lack HTML knowledge, that is not correct my friend. I'm a php web developer and i know the html structure front to back believe me. If the images of the signature were embedded automatically by the Outlook automation, i would do something different believe me, i would programmatically insert that text inside the body.
The problem is that, even if i just put the variable "x" the images don't show.
My problem is: doing this in foxpro.
Because i already did this in php, and i have a ActiveX to create email messages from chilkat "http://www.example-code.com/foxpro/smtp.asp"Â that embeds the images automatically.
But what i need now is to do it in foxpro and Microsoft Outlook...
I'm ok with and ActiveX to do this if you guys know one, i'm willing to pay for it if necessary.
Thank you very much for all you answer Experts, hope you guys can help me with this..
Mike
Ok, so let's see.
@jrbbldr:
I know the images are not embedded as i told you, and i know they have to be. but that's why i asked my friend, i don't know "how to" in foxpro. i'm a php developer for example, and in that case i would not have any problem, but in foxpro i have :)
@pcelba:
You say that my HTML message is overwritten completely. Well, what message? You mean the signature that Outlook creates by default at beginning of the message?
As i said in my comment "(since the problem is when we set the .BodyHtml, the signature that is set by default is overwritten)", i already told that, i know that.
That's why wrote in my code "Adding text!!<br>" + x, meaning that is some text and variable "x", that variable is the signature..makes some sense i guess but doesn't work.
@Olaf_Doschke:
I already tried that. Add the text after the .Display, but didn't work as well (but will try again, just in case Olaf).
As for you say that i lack HTML knowledge, that is not correct my friend. I'm a php web developer and i know the html structure front to back believe me. If the images of the signature were embedded automatically by the Outlook automation, i would do something different believe me, i would programmatically insert that text inside the body.
The problem is that, even if i just put the variable "x" the images don't show.
My problem is: doing this in foxpro.
Because i already did this in php, and i have a ActiveX to create email messages from chilkat "http://www.example-code.com/foxpro/smtp.asp"Â that embeds the images automatically.
But what i need now is to do it in foxpro and Microsoft Outlook...
I'm ok with and ActiveX to do this if you guys know one, i'm willing to pay for it if necessary.
Thank you very much for all you answer Experts, hope you guys can help me with this..
Mike
To use oOutLookObject variable for two different objects is a mistake in your code but that's not the main concern here.
I've missed the fact about x variable containing the whole signature in yuour code...
Does the signature contain all images when you send empty message (menas no .HTMLBody update)?
If yes then the only way is to insert your message text into the .HTMLBody as suggested by Olaf.
I've missed the fact about x variable containing the whole signature in yuour code...
Does the signature contain all images when you send empty message (menas no .HTMLBody update)?
If yes then the only way is to insert your message text into the .HTMLBody as suggested by Olaf.
>I'm a php web developer and i know the html structure front to back believe me
I believe you, but then you should know better how to extend a html message.
Pardon me, if you feel underestimated, but in any case, being new to html or not, my recommended way to see what you get will help you figure out, what happens.
To your information HTMLBody is not as the name suggests just the HTML body, it's the full html code beginning with "<html...", ending with the closing "</html>".
So the quiz question is, what do you get if you add some text in front of the opening html tag? It's simply ignored, because it's not interpreted as part of the html document.
Just configure outlook for new mails to be html type and define a default signature. Then do this:
In my case, though I have a rather short sig this is writing a 22KB html document to disc, lot's of CSS which might be used, but mostly isn't. It's really messy. To extend that right before the signature, you have to find your way inside the body tag, as you know, the real content is in there and not in front of <html>.
Bye, Olaf.
Edit: You can of course also reuse your Chilkat components with VFP, it's also capable to use ActiveX. You just need to merge the complex MS office HTML signatures with your html.
I believe you, but then you should know better how to extend a html message.
Pardon me, if you feel underestimated, but in any case, being new to html or not, my recommended way to see what you get will help you figure out, what happens.
To your information HTMLBody is not as the name suggests just the HTML body, it's the full html code beginning with "<html...", ending with the closing "</html>".
So the quiz question is, what do you get if you add some text in front of the opening html tag? It's simply ignored, because it's not interpreted as part of the html document.
Just configure outlook for new mails to be html type and define a default signature. Then do this:
oOutLook = CreateObject("Outlok.Application")
oMail = oOutlook.CreateItem(0)
oMail.Display()
strtoFile(oMail.HTMLBody,"C:\Temp\OutlookMail.html")
In my case, though I have a rather short sig this is writing a 22KB html document to disc, lot's of CSS which might be used, but mostly isn't. It's really messy. To extend that right before the signature, you have to find your way inside the body tag, as you know, the real content is in there and not in front of <html>.
Bye, Olaf.
Edit: You can of course also reuse your Chilkat components with VFP, it's also capable to use ActiveX. You just need to merge the complex MS office HTML signatures with your html.
ASKER
Hi Olaf,
Yes i know the HTMLBody must have the full html code and of course i have my Outlook set to use HTML, sorry i didn't mentioned.
Maybe i'm explaining this bad, that's why we're loosing time with things i already tested and did..
In my code i mentioned this: ADIR(aHtmSig,GETENV("APPDA TA")+"\Mic rosoft\Sig natures\*. htm")
This as the full html code from the <html> to </html>.
And like i said, i used only that html code alone, adding nothing more and still the images don't embed.
Meanwhile i did run more tests and was even able to create an MHT code with the images embed inside, but when the email opens with that code in the .HTMLBody, it shows all the html code instead of processing it :(
Yes i know the HTMLBody must have the full html code and of course i have my Outlook set to use HTML, sorry i didn't mentioned.
Maybe i'm explaining this bad, that's why we're loosing time with things i already tested and did..
In my code i mentioned this: ADIR(aHtmSig,GETENV("APPDA
This as the full html code from the <html> to </html>.
And like i said, i used only that html code alone, adding nothing more and still the images don't embed.
Meanwhile i did run more tests and was even able to create an MHT code with the images embed inside, but when the email opens with that code in the .HTMLBody, it shows all the html code instead of processing it :(
ASKER
Ok Olaf,
I even did what you said, i got the code generated by Outlook himself:
strtoFile(oMail.HTMLBody," C:\Temp\Ou tlookMail. html")
I grabbed that code and put it inside the HTMLBody exactly as Outlook generated, and everything works fine besides the image, doesn't show...
This was exactly what i done in the beginning.. back to square one :(
I even did what you said, i got the code generated by Outlook himself:
strtoFile(oMail.HTMLBody,"
I grabbed that code and put it inside the HTMLBody exactly as Outlook generated, and everything works fine besides the image, doesn't show...
This was exactly what i done in the beginning.. back to square one :(
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Hi,
No it's no problems with the Outlook configuration, i checked all that before coding.
Course the problem is with the image not being embedded inside.
I was hoping someone here could help me with that..
Must be with an cid like you say, like the mht file does and i tried that..
Before you answer this, i found out this answer: https://www.experts-exchange.com/questions/20384061/Embedding-a-picture-in-an-Outlook-Message.html
It heads up with what you're said "Are you attaching the image and using the mail format of a img src as "cid:image.jpg" to reference an image?"
I'm running tests now.
Thx for helping, i'll put my code here if it works.
No it's no problems with the Outlook configuration, i checked all that before coding.
Course the problem is with the image not being embedded inside.
I was hoping someone here could help me with that..
Must be with an cid like you say, like the mht file does and i tried that..
Before you answer this, i found out this answer: https://www.experts-exchange.com/questions/20384061/Embedding-a-picture-in-an-Outlook-Message.html
It heads up with what you're said "Are you attaching the image and using the mail format of a img src as "cid:image.jpg" to reference an image?"
I'm running tests now.
Thx for helping, i'll put my code here if it works.
It seems you missed my answer... So could you please test following code on your machine? It works for me.
PROCEDURE EnviaEmailBOCl
LPARAMETERS EmailCl, Assunto, Texto, Ficheiro
LOCAL EnviaOk
EnviaOk = .t.
IF EnviaOk
#DEFINE MAILITEM 0
#DEFINE IMPORTANCELOW 0
#DEFINE IMPORTANCENORMAL 1
#DEFINE IMPORTANCEHIGH 2
oOutLookObject = CreateObject("Outlook.Application")
oEmailItem = oOutLookObject.CreateItem(MAILITEM)
oOutLookInspectorObject = oEmailItem.GetInspector
WITH oEmailItem
.Recipients.Add(EmailCL) && uses the Recipients collection
&&.CC="assistente@acidados.pt"
.Subject = Assunto
.Importance = IMPORTANCENORMAL
**.Display()
*.HtmlBody = "Adding text!!<br>" + x
DO CASE
CASE ATC("<body>", .HtmlBody) > 0
lcBodyTag = "<body>"
CASE ATC("<body ", .HtmlBody) > 0
lcBodyTag = STREXTRACT(.HtmlBody, "<body ", ">", 1, 5)
OTHERWISE
*-- No signature probably (needs additional processing)
WAIT WINDOW "Unexpected message HTML Body" TIME 5
lcBodyTag = ""
ENDCASE
.HtmlBody = STUFF(.HtmlBody, ATC(lcBodyTag, .HtmlBody)+LEN(lcBodyTag), 0, "Adding text!!<br>")
.Attachments.Add(Ficheiro) && Note that the fully qualified path and file is required.
**.Send
.Display
ENDWITH
RELEASE oEmailItem
RELEASE oOutLookInspectorObject
RELEASE oOutLookObject
ENDIF
ENDPROC
ASKER
Ok,
With Olaf help and with some more search i manage to found a good solution:
Thx everyone!
With Olaf help and with some more search i manage to found a good solution:
#define olMailItem 0
#define olAppointmentItem 1
#define olContactItem 2
#define olTaskItem 3
#define olJournalItem 4
#define olNoteItem 5
#define olPostItem 6
*/ Folder Constants
#define olFolderCalendar 9
#define olFolderContacts 10
#define olFolderDeletedItems 3
#define olFolderInBox 6
#define olFolderJournal 11
#define olFolderNotes 12
#define olFolderOutBox 4
#define olFolderSentMail 5
#define olFolderTask 13
#define olBusy 2
#define True .t.
#define False .f.
#define olPrivate 2
*/ Importance Constants
#define olImportanceLow 0
#define olImportanceNormal 1
#define olImportanceHigh 2
oOutLookObject = CreateObject("Outlook.Application")
oEmailItem = oOutLookObject.CreateItem(olMailItem)
oOutLookObject = oEmailItem.GetInspector
** We have our signatures in the web, but from a local folder or local network is good anyway
TRY
loHttp = CREATEOBJECT('MSXML2.ServerXmlHttp')
loHttp.open('Get', 'http://twice-global.com/contactos/assinatura.php?ID=10&Pais=Portugal&info=false',.F.)
loHttp.send()
*msg(STRCONV(loHttp.responseBody, 9))
CATCH TO loException
msg("Error:"+m.loException.Message)
ENDTRY
x= STRCONV(loHttp.responseBody, 9)
lcImage = "\\server\assinaturas_imagens\logo-email-Portugal.gif"
lcImage2 = "\\server\assinaturas_imagens\icon-plus.gif"
** justfname is essencial, otherwise the images will appear in the atachements
x = STRTRAN(x, "imagens/logo-email-Portugal.gif",justfname(lcImage))
x = STRTRAN(x, "imagens/icon-plus.gif",justfname(lcImage2))
WITH oEmailItem
*.Recipients.Add(EmailCL) && uses the Recipients collection
.to = EmailCL
&&.CC="assistente@acidados.pt"
.Subject = Assunto
.ReadReceiptRequested = True && Just for the heck of it
.Importance = olImportanceNormal
.HtmlBody = x
* Save is needed if you add more than one attachment
.save
.Attachments.ADD(lcImage)
.Attachments.ADD(lcImage2)
.Attachments.Add(Ficheiro) && Note that the fully qualified path and file is required.
**.Send
.Display
ENDWITH
RELEASE oEmailItem
RELEASE oOutLookObject
Thx everyone!
Good you've found the solution.
I am just interested if the one posted in message ID: 38166800 is working or not.
I am just interested if the one posted in message ID: 38166800 is working or not.
Pavel, it works form me, but it seems the need to add a bit text was just the beginning and there rather was the need to add images as well.
@justaphase, just as a side note: ReadReceiptRequested doesn't needs to be set, outlook will ask the user, if he wants to fullfill that request to confirm the reading of a mail. This has nothing to do with the security measures of outlook to suppress images and only offer to show images with an option at the top of the mail item window.
In the end the user can decide what to see or not and what confirmation to send to the sender or not.
There are some things you can't do for sure: both outlook, but also web mail clients like gmail don't render a body background-image. There are several limitations about html mails.
Thanks for sharing your solution with it's comments. It could become helpful. Nowadays I rather compose html mails via BLAT.DLL, but for a customer with outlook this is of course not wanted.
Bye, Olaf.
@justaphase, just as a side note: ReadReceiptRequested doesn't needs to be set, outlook will ask the user, if he wants to fullfill that request to confirm the reading of a mail. This has nothing to do with the security measures of outlook to suppress images and only offer to show images with an option at the top of the mail item window.
In the end the user can decide what to see or not and what confirmation to send to the sender or not.
There are some things you can't do for sure: both outlook, but also web mail clients like gmail don't render a body background-image. There are several limitations about html mails.
Thanks for sharing your solution with it's comments. It could become helpful. Nowadays I rather compose html mails via BLAT.DLL, but for a customer with outlook this is of course not wanted.
Bye, Olaf.
I've tested signature with images which were placed on local disk only. They were copied to the Signature folder by Outlook (or by Word probably).
It means signatures must be available during the message composition and no need to attach them to the message. Outlook should do it automatically. I don't think the process is different for images placed on web and identified by UNC path.
The only situation when signatures "disappeared" was caused by the HTML body corruption in command ".HtmlBody = "Adding text!!<br>" + x".
And for this reason my question was also: "Does the image appear in empty message containing just the signature?
It means signatures must be available during the message composition and no need to attach them to the message. Outlook should do it automatically. I don't think the process is different for images placed on web and identified by UNC path.
The only situation when signatures "disappeared" was caused by the HTML body corruption in command ".HtmlBody = "Adding text!!<br>" + x".
And for this reason my question was also: "Does the image appear in empty message containing just the signature?
ASKER
Hi guys,
@Olaf:
- ReadReceiptRequested can indeed be set on outlook options, but in this case this project is for a team off salesman in our company, and rather they set it or not we will force it just in case, because it's demanded.
- About your comment "This has nothing to do with the security measures of outlook to suppress images and only offer to show images with an option at the top of the mail item window."... Well, remember that Outlook can automatically download the images if you add the sender or domain to the safe list. Safe list is related to security measures i think.
- When you say "both outlook, but also web mail clients like gmail don't render a body background-image. There are several limitations about html mails." and when you say "In the end the user can decide what to see or not"... To me that can be valid if your building a big document with images, but not in this case, this is a signature, and those images are related to the company trademark and logo, so to me it should be shown.
- And remember, i'm not putting the images on background, i'm embedding them in the html body. the source of the image is inside the code..resulting in one good thing, the image will be shown booth in outlook and gmail, i have test it.
@pcelba:
I suggest you read all posts, they answer all your questions, but i en light you anyway.
You say this:
- "I've tested signature with images which were placed on local disk only. They were copied to the Signature folder by Outlook (or by Word probably).", ... "It means signatures must be available during the message composition"
That is correct, but the problem is when you set the .HTMLBody you erase all the html Outlook builds in the beginning of the message, and you can't add text to the original html body message, you just set a new one.
So, what you can do is grab that html code and put it again in the message together with the text you want to add.. and again another problem, when you grab that html that Outlook generates you have an issue.. Outlook doesn't make the courtesy of giving the correct code with the image embedded inside, so the image is not shown.
- You also say this "The only situation when signatures "disappeared" was caused by the HTML body corruption in command ".HtmlBody = "Adding text!!<br>" + x".".
As i already explain to Olaf, that was just a stupid example, because i told i test it only like this: ".HtmlBody = x" and didn't work because as said just now the images don't go embedded in the html code.
So the solution for this problem is set the correct html with the body text and the signature and then attach the images of the signature to the email (like you attach a regular file). After that in the html you  set source of the images with the name of the image file (you give with real path of image processed by this foxpro function "justfname" that returns only the name of the file and removes the path).
Outlook will understand that its the image you just attached and is already embedded in the email message, and he will show the image with no problem transforming the source of the image with an "cid" and removes the image file from "attached documents" and leaves it as a normal image embedded in the code.
Hope i explained my self correctly :)
@Olaf:
- ReadReceiptRequested can indeed be set on outlook options, but in this case this project is for a team off salesman in our company, and rather they set it or not we will force it just in case, because it's demanded.
- About your comment "This has nothing to do with the security measures of outlook to suppress images and only offer to show images with an option at the top of the mail item window."... Well, remember that Outlook can automatically download the images if you add the sender or domain to the safe list. Safe list is related to security measures i think.
- When you say "both outlook, but also web mail clients like gmail don't render a body background-image. There are several limitations about html mails." and when you say "In the end the user can decide what to see or not"... To me that can be valid if your building a big document with images, but not in this case, this is a signature, and those images are related to the company trademark and logo, so to me it should be shown.
- And remember, i'm not putting the images on background, i'm embedding them in the html body. the source of the image is inside the code..resulting in one good thing, the image will be shown booth in outlook and gmail, i have test it.
@pcelba:
I suggest you read all posts, they answer all your questions, but i en light you anyway.
You say this:
- "I've tested signature with images which were placed on local disk only. They were copied to the Signature folder by Outlook (or by Word probably).", ... "It means signatures must be available during the message composition"
That is correct, but the problem is when you set the .HTMLBody you erase all the html Outlook builds in the beginning of the message, and you can't add text to the original html body message, you just set a new one.
So, what you can do is grab that html code and put it again in the message together with the text you want to add.. and again another problem, when you grab that html that Outlook generates you have an issue.. Outlook doesn't make the courtesy of giving the correct code with the image embedded inside, so the image is not shown.
- You also say this "The only situation when signatures "disappeared" was caused by the HTML body corruption in command ".HtmlBody = "Adding text!!<br>" + x".".
As i already explain to Olaf, that was just a stupid example, because i told i test it only like this: ".HtmlBody = x" and didn't work because as said just now the images don't go embedded in the html code.
So the solution for this problem is set the correct html with the body text and the signature and then attach the images of the signature to the email (like you attach a regular file). After that in the html you  set source of the images with the name of the image file (you give with real path of image processed by this foxpro function "justfname" that returns only the name of the file and removes the path).
Outlook will understand that its the image you just attached and is already embedded in the email message, and he will show the image with no problem transforming the source of the image with an "cid" and removes the image file from "attached documents" and leaves it as a normal image embedded in the code.
Hope i explained my self correctly :)
Thanks for the explanation but I still think this image joggling is not necessary because you may update the signature which already exists in HTMLBody by command:
.HtmlBody = STUFF(.HtmlBody, ATC(lcBodyTag, .HtmlBody)+LEN(lcBodyTag), 0, "Adding text!!<br>")
which was used in my code sample in the post ID: 38166800 above. ( And I've been asking to test this code because I am curious how it works on your machine...)
But if you have working solution then I understand you don't like to be bothered by this problem any more.
.HtmlBody = STUFF(.HtmlBody, ATC(lcBodyTag, .HtmlBody)+LEN(lcBodyTag),
which was used in my code sample in the post ID: 38166800 above. ( And I've been asking to test this code because I am curious how it works on your machine...)
But if you have working solution then I understand you don't like to be bothered by this problem any more.
justaphase,
you explained yourself well.
But as you said ".HtmlBody = x didn't work because as said just now the images don't go embedded in the html code". That's only half the truth. The signature itself works with it's pictures, if you don't interfere with it. Pavel also only added text and YOU miss the foxpro function STUFF inserts new text into the html.
Indeed you're right that's not the only ingredients needed, and the info to embed images by attaching them and by adressing them with cid: prefix as src was more valuable than the html merging of pavel.
Bye, Olaf.
you explained yourself well.
But as you said ".HtmlBody = x didn't work because as said just now the images don't go embedded in the html code". That's only half the truth. The signature itself works with it's pictures, if you don't interfere with it. Pavel also only added text and YOU miss the foxpro function STUFF inserts new text into the html.
Indeed you're right that's not the only ingredients needed, and the info to embed images by attaching them and by adressing them with cid: prefix as src was more valuable than the html merging of pavel.
Bye, Olaf.
ASKER
@Olaf:
"The signature itself works with it's pictures, if you don't interfere with it."
That is correct, but when you need to interfere to add more text, and when you set the .HTMLBody, you completely interfere with it, even using the value inside the .HTMLBody, you loose the connection to the embedded images. That's what happens.
@pcelba:
I'm sorry, i should have test it, but when i saw you only adding text to the .HTMLBody value and replace it..i didn't even gave my self the trouble.
Anyway i did test it now, and doesn't work.
What you doing is exactly what i did in a different way.. i used STRTRAN to replace a certain part of the html body with another, STUFF does the same thing in a different way, it adds text by replacing a specified number of characters in a character expression with another character expression..
And in the end we have the same problem, the images loose the cid source and don't show.
"The signature itself works with it's pictures, if you don't interfere with it."
That is correct, but when you need to interfere to add more text, and when you set the .HTMLBody, you completely interfere with it, even using the value inside the .HTMLBody, you loose the connection to the embedded images. That's what happens.
@pcelba:
I'm sorry, i should have test it, but when i saw you only adding text to the .HTMLBody value and replace it..i didn't even gave my self the trouble.
Anyway i did test it now, and doesn't work.
What you doing is exactly what i did in a different way.. i used STRTRAN to replace a certain part of the html body with another, STUFF does the same thing in a different way, it adds text by replacing a specified number of characters in a character expression with another character expression..
And in the end we have the same problem, the images loose the cid source and don't show.
OK, thanks for the test. Even if it does not work for you we may leave it as it is...
Just a small correction: My STUFF does not replace any part of HTML body because it just inserts new text onto the place where it should cause no damage. OTOH, Â STRTRAN always replaces some part of the string.
It seems your Outlook configuration will probably destroy images (or their CID source) even when you leave HTMLBody unchanged when the signature alone will be sent.
Just a small correction: My STUFF does not replace any part of HTML body because it just inserts new text onto the place where it should cause no damage. OTOH, Â STRTRAN always replaces some part of the string.
It seems your Outlook configuration will probably destroy images (or their CID source) even when you leave HTMLBody unchanged when the signature alone will be sent.
ASKER
Hi,
About STUFF i explain my self the wrong way sorry, i said a "adds text" and then mentioned "replace", lol..
When you say this: "It seems your Outlook configuration will probably destroy images (or their CID source) even when you leave HTMLBody unchanged when the signature alone will be sent."
It's wrong.. when you do this HTMLBody = Something, no matter what it is you are replacing the value, so you don't leave HTMLBody unchanged, even using the exact same code.
About STUFF i explain my self the wrong way sorry, i said a "adds text" and then mentioned "replace", lol..
When you say this: "It seems your Outlook configuration will probably destroy images (or their CID source) even when you leave HTMLBody unchanged when the signature alone will be sent."
It's wrong.. when you do this HTMLBody = Something, no matter what it is you are replacing the value, so you don't leave HTMLBody unchanged, even using the exact same code.
So do you also think the command ".HTMLBody = .HTMLBody" will change the .HTMLBody with the result in missing images?
I still cannot believe the code in post ID: 38166800 will "remove" images.
I still cannot believe the code in post ID: 38166800 will "remove" images.
ASKER
Well pcelba... i really don't know what to say anymore..
I did:
I did:
in my tests i didn't use the actual value inside the code on demand, i copied into another file and used it...guess some code didn't went when i copied.. hidden or something.
And also your code didn't work well but wasn't because of the concept, something in the code its just not resulting...
I already thought about this solution in first place.. i can't believe i test all this wrong..
The only good thing i see about this, is that forced me to do a better solution, because i'm using a default html code from a different source. if i used the .HTMLBody value, would result in the future in someone change the signature and the html code would not be the same, and the STRTRAN would fail in replacing the code.
Thx alot for your help pcelba
I did:
.HtmlBody = .HtmlBody
And actually the images didn't disappeared..I did:
.HtmlBody = STRTRAN(.HtmlBody, "<body lang=PT link=blue vlink=purple style='tab-interval:35.4pt'>","<body lang=PT link=blue vlink=purple style='tab-interval:35.4pt'> AHHAHAHAH")
And i can't believe that the images also didn't disappeared...in my tests i didn't use the actual value inside the code on demand, i copied into another file and used it...guess some code didn't went when i copied.. hidden or something.
And also your code didn't work well but wasn't because of the concept, something in the code its just not resulting...
I already thought about this solution in first place.. i can't believe i test all this wrong..
The only good thing i see about this, is that forced me to do a better solution, because i'm using a default html code from a different source. if i used the .HTMLBody value, would result in the future in someone change the signature and the html code would not be the same, and the STRTRAN would fail in replacing the code.
Thx alot for your help pcelba
That is true. Â
From w3schools.com - Images are not technically inserted into an HTML page, images are linked to HTML pages. The <img> tag creates a holding space for the referenced image.
That means that your signature image file on your network which is referenced is not available to the email recipient on their own network and therefore not visible.
By doing a Google search I found the following which might help you out.
  Embedding images in email
  http://www.campaignmonitor.com/blog/post/1761/embedding-images-in-email/
Good Luck