Sending a logo in an email

Sending a logo in an email

Postby driessen » 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. 24.02 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc77
User avatar
driessen
 
Posts: 1396
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Postby Frank Demont » Fri Feb 23, 2007 9: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
Frank Demont
 
Posts: 142
Joined: Sun Oct 09, 2005 10:59 am

Postby driessen » Fri Feb 23, 2007 9: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. 24.02 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc77
User avatar
driessen
 
Posts: 1396
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Postby James Bott » Fri Feb 23, 2007 5: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Enrico Maria Giordano » Fri Feb 23, 2007 7: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
User avatar
Enrico Maria Giordano
 
Posts: 8344
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby James Bott » Fri Feb 23, 2007 8: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

Code: Select all  Expand view
<!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: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Enrico Maria Giordano » Sat Feb 24, 2007 12:03 am

Do you have a working sample?

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

Postby James Bott » Sat Feb 24, 2007 3: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


Code: Select all  Expand view
// 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
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

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

Postby James Bott » Sat Feb 24, 2007 6: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby James Bott » Sat Feb 24, 2007 7:40 pm

Enrico,

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

Code: Select all  Expand view
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
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Enrico Maria Giordano » Sat Feb 24, 2007 9:41 pm

James Bott wrote:I presume you tested it with Outlook?


No, I tested it with Outlook Express.

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

Postby Enrico Maria Giordano » Sat Feb 24, 2007 9:42 pm

James Bott wrote:Enrico,

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

Code: Select all  Expand view
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: 8344
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Enrico Maria Giordano » Sat Feb 24, 2007 9: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
User avatar
Enrico Maria Giordano
 
Posts: 8344
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby James Bott » Sat Feb 24, 2007 9: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], Marc Venken, Otto and 31 guests