Sending a logo in an email

User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Sending a logo in an email

Post 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
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
Frank Demont
Posts: 142
Joined: Sun Oct 09, 2005 10:59 am

Post 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
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Post 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
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post 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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post 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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post 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>&nbsp;</DIV>
<P></P></BODY></HTML>
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post 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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post 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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post 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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post 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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

James Bott wrote:I presume you tested it with Outlook?
No, I tested it with Outlook Express.

EMG
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post 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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post 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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post 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
Post Reply