Page 1 of 2
Sending a logo in an email
Posted: Thu Feb 22, 2007 12:58 pm
by driessen
Hello,
Can oMail:HTMLBody be used to define a letterpaper for my outgoing emails ?
If so, how do I have to do that ?
I want to send emails from my application and I want each email to start with my logo.
How do I do that ?
Thanks.
Regards,
Michel
Posted: Fri Feb 23, 2007 9:48 am
by Frank Demont
Michel,
Build your output as every print output from fivewin . You can use bitmaps, ......
As printer : PDFcreator (must be installed) , or a better solution is Image2Pdf.dll (i have working sample) in combination with OLE outlook or SMTP
Then you can send a e-mail with attachement PDF file
Frank
Posted: Fri Feb 23, 2007 9:57 am
by driessen
Frank,
I think you haven't quite understood what I mean.
I'd like to send an email out of my application and I want a logo put in the body of every email I send.
In Outlook you can do that by using "letterpaper" (in Dutch : "briefpapier").
I'd like to know how we can do that from a FW-application.
Thanks anyway.
Michel
Posted: Fri Feb 23, 2007 5:22 pm
by James Bott
Michel,
You have to build the logo into the HTML just like any webpage. Outlook just does this by starting with the letterhead HTML page that is blank inside, then the user fills it in. It is not a separate page. You will have to do the same with your code.
Personally, I wouldn't do it. It doesn't seem to be very popular with recipients because of the larger size of the mail. Also, it is very hard to do a reply to it as the format of the reply becomes messy.
James
Posted: Fri Feb 23, 2007 7:07 pm
by Enrico Maria Giordano
James Bott wrote:You have to build the logo into the HTML just like any webpage.
It's not so simple as you can't refer to a local image. It will work if you link an image on the web but it will likely be blocked by the security policy.
You should use the internal link to an internal image (ie. an image embedded to the message) but I don't know how to create such a message.
EMG
Posted: Fri Feb 23, 2007 8:02 pm
by James Bott
Enrico,
I believe the image just gets converted to MIME format when sent. Below is a copy of a stationary from Outlook Express. You can see there is just a local link to an image (actually two images--one is the background).
I would think you could create similar code with FWH and then insert it into the Outlook mail as HTML.
James
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE id=ridTitle>Nature</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"><BASE
href="file://C:\Program Files\Common Files\Microsoft Shared\Stationery\">
<STYLE><!-- body { font-family: Trebuchet MS, Verdana; font-size: 10pt; color: #333399; margin-top: 5px; margin-left: 30px; } img { margin-top: 5px; margin-left: -30px; } --></STYLE>
<META content="MSHTML 6.00.6000.16414" name=GENERATOR></HEAD>
<BODY id=ridBody bgColor=#f4f4f4 background="Nature Bkgrd.jpg"><IMG id=ridImg
src="anabnr2.gif" align=bottom>
<P></P>
<DIV> </DIV>
<P></P></BODY></HTML>
Posted: Sat Feb 24, 2007 12:03 am
by Enrico Maria Giordano
Do you have a working sample?
EMG
Posted: Sat Feb 24, 2007 3:06 am
by James Bott
Enrico,
Below is the code for doing a letterhead in Outlook Express (tested and working). I do not have a copy of Outlook installed here to create a test for Outlook.
The code is nothing special. You just specify the HTM file and do NOT include a message. I think the file extension must be HTM not HTML, if I remember correctly.
As per the note below, the entire HTML file must be built using FW code--including the salutation, message, and signature of the sender (if you want fully automated emails). The HTML file I used is similar to the one I previously posted.
Creating the HTML file shouldn't be too difficult. You could just store it in several pieces each in a separate file, then load all the pieces and paste them together with the saluation, message, and signature, pasted in the appropriate places. Then save it as a temp file and send. I would use a timer to then delete the temp file after a short delay.
If you want the HTM and JPG files also, let me know and I will email them to you.
James
Code: Select all
// Purpose: Demonstrate the creation of a letterhead email.
// Author: James Bott
/* Note: You have to create the .HTM file using FW code--you can't just pass
a message. The message has to be already in the HTML code.
*/
#include "fivewin.ch"
#include "mail.ch"
function main()
local oMail,cMsg,cTo,cAddress,cSubject
cTo:="James Bott"
cSubject:="Test letterhead mail"
DEFINE MAIL oMail ;
SUBJECT OemToAnsi(cSubject) ;
TO cTo, cAddress;
FILES "c:\fw\mapisend\lhead.htm","lhead.htm";
FROM USER
ACTIVATE MAIL oMail
IF oMail:nRetCode#0
MsgAlert("The message could not be sent!","Error " + alltrim(cValToChar(oMail:nRetCode#0)) )
ELSE
//MsgInfo("Message sent successfully!")
ENDIF
return nil
Posted: Sat Feb 24, 2007 10:08 am
by Enrico Maria Giordano
Sorry but your sample uses a local disk reference to the images, not an internal message reference. Therefore it won't show any images when received by the recipient (I just tested this).
EMG
Posted: Sat Feb 24, 2007 6:35 pm
by James Bott
Enrico,
>Sorry but your sample uses a local disk reference to the images, not an internal message reference. Therefore it won't show any images when received by the recipient (I just tested this).
I presume you tested it with Outlook? Because it does work with OE. Doesn't Outlook also use stationary? If so, then I don't know why it won't work.
James
Posted: Sat Feb 24, 2007 7:40 pm
by James Bott
Enrico,
In your test did you set the path properly using this line from the sample above?
Code: Select all
BASE href="file://C:\Program Files\Common Files\Microsoft Shared\Stationery\
It needs to be set to the path of the images.
James
Posted: Sat Feb 24, 2007 9:41 pm
by Enrico Maria Giordano
James Bott wrote:I presume you tested it with Outlook?
No, I tested it with Outlook Express.
EMG
Posted: Sat Feb 24, 2007 9:42 pm
by Enrico Maria Giordano
James Bott wrote:Enrico,
In your test did you set the path properly using this line from the sample above?
Code: Select all
BASE href="file://C:\Program Files\Common Files\Microsoft Shared\Stationery\
It needs to be set to the path of the images.
James
No, as I haven't that path in "Program Files" (or in Programmi).
EMG
Posted: Sat Feb 24, 2007 9:46 pm
by Enrico Maria Giordano
James, I received your test message and it work great (I can see the image). Can you send me a complete sample to test here?
EMG
Posted: Sat Feb 24, 2007 9:51 pm
by James Bott
Enrico,
>No, as I haven't that path in "Program Files" (or in Programmi).
I meant that you need to modify that line to whatever path you need so that it points to the image files you are using.
>James, I received your test message and it work great (I can see the image). Can you send me a complete sample to test here?
Done.
James