Welcome! Log In Create A New Profile

Advanced

Email Problem

Posted by Milton 
Milton
Email Problem
March 01, 2009 10:16PM
Hi All,

I am trying to include images in the body of an email without success. In the HELP it seems only to allow images as attachments to emails rather than allowing embedding in the body of the email. My email send code is as below.

Does anyone have any ideas on how to include images in the body of emails?

gRecipient = AllPeople.enqEmail
EmailStartSMTPSession "MyAddress","MyPassword","MyMailServer")
Email.Recipient = gRecipient
Email.Sender = "MyReturnAddress"
Email.Subject = gSubject
Email.Message = "Dear "+Upper(AllPeople.enqFirst)+", "+gMessage
Email.Attach=gAttachment
Email.NbAttach=0
Email.NbRecipient = 1
EmailSendMessage("MySender")
HReadNext(AllPeople,AllPeopleID)


Thanks in advance,

Milton
David Martin
Re: Email Problem
March 01, 2009 10:54PM
I have not done this using the built-in mail stuff in WinDev ... but ... you need to define Parts in your message body and then you can tell it a part is an image ... you will have to Base64 encode the image before including it.

And, as mentioned in the help, you can look at RFC822 and RFC2045 to RFC2049 for how to format a email body in MIME. If you are unfamiliar with MIME Google came back with some pretty good explanations using "format email body mime".

I have done this using the SocketTools Library but it has the necessary Properties and Methods for handling it very simply.

Hope this helps ...

David



Edited 3 time(s). Last edit at 03/01/2009 11:30PM by David Martin.
David Martin
Re: Email Problem
March 01, 2009 11:06PM
Ok, got me thinking...

Under "Writing an email" in the help it says:
Use EmailImportHTML to initialize the variables of the email. If the
email contains images or multimedia files, they will be automatically added
as attachments and the content of the HTML email will be modified to manage
the attachments.
So, I wonder if that means it will put them as attachments but also display them in the body.

Of course, that is assuming that you want to send your emails out as HTML.

David
Milton
Re: Email Problem
March 02, 2009 01:54AM
Hi David,

Thanks for your reply - I actually tried the HTML route by using "import HTML" where I had prepared a Word document with included images and saved it as HTML.

It imported the text content and simply put the images as attachments without having them in the body of the email.

I will have a look at your first suggestion and see what I can figure unless someone else hs done this before.

Many thanks,

Milton
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: