Sending a logo in an email

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, thanks to your help I found what the problem was: it works fine if you use FROM USER clause but no if you remove it. Without FROM USER clause the image seems not to be embedded.

Can you try it there?

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,

Yes, I confirm that if you don't use the FROM USER clause, the image is not included, only the link. This seems to be a bug in OE.

I found that there is a setting under Tools, Options, Send tab, Mail Sending Format, HTML Settings button, that has a checkbox "Send Pictures with messages" and it is checked. However, this seems to be being ignored when sending without user interaction.

James
Ollie
Posts: 233
Joined: Sat Dec 30, 2006 6:10 am

Post by Ollie »

This works with Outlook, (Pics embedded in the HTML to arrive at user) but same problem occurs when lFromUser=.F., the HTML file isn't the body anymore, but an attachment.

Usage example:

SendEmail("ollie@theoasis.co.za","Email Subject","",{DEFPATH()+"test.htm"},{"test.htm"},.T.)

But I haven't figured out how to send to multiple recipients - any ideas?

Code: Select all

PROCEDURE SendEmail( cTo, cSubject, cBody, aFiles_with_path, aFiles_only_name, lPause  )
   LOCAL i, oMail, aFiles
   DEFAULT lPause:=.T.
   //Second SendEmail option.

//   local cSubject, cBody, aTo, aFiles

      DEFINE MAIL oMail SUBJECT cSubject ;
             TEXT cBody ;
             TO cTo ;
             FROM USER

      aFiles:={}
   FOR i:= 1 TO Len(aFiles_with_path)
      IF FILE(aFiles_with_path[i])
         AADD(aFiles,{aFiles_with_path[i],aFiles_only_name[i]})
      ELSE
         MSGINFO(aFiles_only_name[i]+" File not found: "+aFiles_with_path[i],"Email")
      ENDIF
   NEXT
   IF LEN(aFiles)>0
         oMail:aFiles := aFiles //{{DEFPATH() + "..\Error.log","testError.txt"},{DEFPATH() + "..\Error.log","t2estError.log"}}//aFilenames
      ENDIF

      oMail:lFromUser := lPause

   ACTIVATE MAIL oMail

   IF oMail:nRetCode!=0
      IF oMail:nRetCode=1
         MSGALERT("Email Cancelled","Email")
         ELSE
   MsgAlert("The message was not sent."+CRLF+CRLF+;
   "MAPI Error code: "+ltrim(str(oMail:nRetCode))+" : "+MAPI_ERROR(oMail:nRetCode),"Error")
   ENDIF
ENDIF

RETURN

STATIC FUNCTION MAPI_ERROR(nErrorCode)
   LOCAL cResult
   LOCAL aError:={"MAPI_USER_ABORT",; //1
   "MAPI_E_FAILURE",; //2
   "MAPI_E_LOGIN_FAILURE",; //3
   "MAPI_E_DISK_FULL",; //4
   "MAPI_E_INSUFFICIENT_MEMORY",; //5
   "MAPI_E_ACCESS_DENIED",; //6
   "UNKNOWN ERROR",; //7
   "MAPI_E_TOO_MANY_SESSIONS",; //8
   "MAPI_E_TOO_MANY_FILES",; //                   9
   "MAPI_E_TOO_MANY_RECIPIENTS",; //             10
   "MAPI_E_ATTACHMENT_NOT_FOUND",; //            11
   "MAPI_E_ATTACHMENT_OPEN_FAILURE",; //         12
   "MAPI_E_ATTACHMENT_WRITE_FAILURE",; //        13
   "MAPI_E_UNKNOWN_RECIPIENT",; //               14
   "MAPI_E_BAD_RECIPTYPE",; //                   15
   "MAPI_E_NO_MESSAGES",; //                     16
   "MAPI_E_INVALID_MESSAGE",; //                 17
   "MAPI_E_TEXT_TOO_LARGE",; //                  18
   "MAPI_E_INVALID_SESSION",; //                 19
   "MAPI_E_TYPE_NOT_SUPPORTED",; //              20
   "MAPI_E_AMBIGUOUS_RECIPIENT",; //             21
   "MAPI_E_MESSAGE_IN_USE",; //                  22
   "MAPI_E_NETWORK_FAILURE",; //                 23
   "MAPI_E_INVALID_EDITFIELDS",; //              24
   "MAPI_E_INVALID_RECIPS",; //                  25
   "MAPI_E_NOT_SUPPORTED"} //                   26
   IF nErrorCode>26.OR.nErrorCode<1
      cResult:= "UNKNOWN ERROR"
   ELSE
      cResult:=aError[nErrorCode]
   ENDIF
   RETURN (cResult)
Many thanks
Ollie.

Using:
xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)
Borland C++ 5.5.1
FWH 9.04 (2009 Apr)
Post Reply