FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Sending a logo in an email
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Sending a logo in an email
Posted: Thu Feb 22, 2007 12:58 PM

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

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 142
Joined: Sun Oct 09, 2005 10:59 AM
Sending a logo in an email
Posted: Fri Feb 23, 2007 09:48 AM

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

Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Sending a logo in an email
Posted: Fri Feb 23, 2007 09:57 AM

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

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Sending a logo in an email
Posted: Fri Feb 23, 2007 05:22 PM

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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Sending a logo in an email
Posted: Fri Feb 23, 2007 07:07 PM
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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Sending a logo in an email
Posted: Fri Feb 23, 2007 08:02 PM
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

<!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>&nbsp;</DIV>
<P></P></BODY></HTML>
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Sending a logo in an email
Posted: Sat Feb 24, 2007 12:03 AM

Do you have a working sample?

EMG

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Sending a logo in an email
Posted: Sat Feb 24, 2007 03:06 AM
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


// 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
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Sending a logo in an email
Posted: Sat Feb 24, 2007 10:08 AM

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

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Sending a logo in an email
Posted: Sat Feb 24, 2007 06:35 PM

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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Sending a logo in an email
Posted: Sat Feb 24, 2007 07:40 PM
Enrico,

In your test did you set the path properly using this line from the sample above?

BASE href="file://C:\Program Files\Common Files\Microsoft Shared\Stationery\


It needs to be set to the path of the images.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Sending a logo in an email
Posted: Sat Feb 24, 2007 09:41 PM
James Bott wrote:I presume you tested it with Outlook?


No, I tested it with Outlook Express.

EMG
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Sending a logo in an email
Posted: Sat Feb 24, 2007 09:42 PM
James Bott wrote:Enrico,

In your test did you set the path properly using this line from the sample above?

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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Sending a logo in an email
Posted: Sat Feb 24, 2007 09:46 PM

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

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Sending a logo in an email
Posted: Sat Feb 24, 2007 09:51 PM

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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10