it has as to below insert image in the sending of email in the example?
#include "fivewin.ch"
****************
FUNCTION SendMail
*****************
LOCAL oOutLook,oMailItem,oRecip,oAttach
oOutLook := TOleAuto():New("Outlook.Application")
oMailItem := oOutLook:Invoke("CreateItem", 0)
oRecip := oMailItem:Invoke("Recipients")
oRecip:Invoke("Add", "lara.softhouse@gmail.com")
oRecip:Invoke("Add", "cleiton.softhouse@bol.com.br")
oMailItem:Set("Subject", "Testing e-mail via ole fw")
oMailItem:Set("Body", "Assunto, referente fatura 0001 no valor de "+CRLF+ ;
"R$ 1.500,00"+CRLF+CRLF+"Tudo Informática"+CRLF)
oAttach := oMailItem:Invoke("Attachments")
oAttach:Invoke("Add", "c:\autoexec.bat")
oAttach:Invoke("Add", "c:\config.sys")
oMailItem:Invoke("Send")
oRecip:End()
oAttach:End()
oMailItem:End()
oOutLook:End()
MsgInfo("Mensagem enviado com sucesso !")
RETURN NIL
To send email with image
To send email with image
Kleyton
Fwh906
Brazil
Fwh906
Brazil
- E. Bartzokas
- Posts: 114
- Joined: Tue Feb 14, 2006 8:13 am
- Location: Corinth, Greece
Re: To send email with image
Kleyton,Kleyton wrote:it has as to below insert image in the sending of email in the example?
#include "fivewin.ch"
****************
FUNCTION SendMail
*****************
LOCAL oOutLook,oMailItem,oRecip,oAttach
oOutLook := TOleAuto():New("Outlook.Application")
oMailItem := oOutLook:Invoke("CreateItem", 0)
oRecip := oMailItem:Invoke("Recipients")
oRecip:Invoke("Add", "lara.softhouse@gmail.com")
oRecip:Invoke("Add", "cleiton.softhouse@bol.com.br")
oMailItem:Set("Subject", "Testing e-mail via ole fw")
oMailItem:Set("Body", "Assunto, referente fatura 0001 no valor de "+CRLF+ ;
"R$ 1.500,00"+CRLF+CRLF+"Tudo Informática"+CRLF)
oAttach := oMailItem:Invoke("Attachments")
oAttach:Invoke("Add", "c:\autoexec.bat")
oAttach:Invoke("Add", "c:\config.sys")
oMailItem:Invoke("Send")
oRecip:End()
oAttach:End()
oMailItem:End()
oOutLook:End()
MsgInfo("Mensagem enviado com sucesso !")
RETURN NIL
I can't really offer much of an advise, and don't even understand exactly the problem you have.
At a glance of an eye based only on programming knowledge, is one thing:
You End() the oRecip, the oAttach, and the oMailItem, after you "Send" the message. Perhaps, this might be a good reason for non working.
Sorry if I cannot help you more, but if you tell me what the problem is, I might look at it.
By the way, I do not use emailing through Outlook or Netscape or any other available emailer program, but a library that I have purchased, which gives me all the flexibility to send/receive, etc. emails with attachments. It is called SMTP / POP3 EMAIL COMPONENT, and is available from <www.marshallsoft.com>, also it is available for evaluation before you buy it, and is very easy to use!
Kind regards
Evans
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Kleyton,
Code: Select all
oMailItem:Set( "HTMLBody", '<HTML><HEAD></HEAD><BODY><img src="http://www.fivetechsoft.com/images/logo5t2.gif"</BODY></HTML>' )
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Kleyton,
Why not just use FW's own TMail class?
James
--------------------------------------
MAPI Mail Syntax:
DEFINE MAIL [ <oMail> ];
[ SUBJECT <cSubject> ];
[ TEXT <cText> ];
[ TYPE <cType> ];
[ DATE <dDate> ];
[ TIME <cTime> ];
[ CONVERSATION <cConversation> ]:
[ RECEIPT ];
[ FROM USER ];
[ FILES <cFilename1> ,<cDescript1>, <cFilenameN>, <cDescriptN> ] ];
[ ORIGIN <cOrigin> [ <cOriginAddress> ] ];
[ TO <cTarget1>, [ <cTargetAddress1> ] [ <cTargetN> [ <cTargetAddressN> ] ] ];
FILES
When specifying an attachment file you must include the path and a description. Use a two dimensonal array, the first element is the filename with path, the second is the description. You can have multiple files by adding more elements.
aFiles:={"c:\my docments\mydoc.doc","mydoc.doc"}
If the attachment file is html (has a .htm or .html extension) and you do not specify any TEXT (a message) then the file will appear in the message area.
ERRORS
If you specify a TO and the parameter is blank and you are using the FROM USER clause, the message compose box will not appear. Likewise if the filename is invalid or not found. It is best to use an error trap:
DEFINE MAIL...
ACTIVATE MAIL...
IF oMail:nRetCode!=0
MsgAlert("The message could not be sent due to an error."+CRLF+;
"MAPI error code: "+ltrim(str(oMail:nRetCode)),"Alert")
ENDIF
Why not just use FW's own TMail class?
James
--------------------------------------
MAPI Mail Syntax:
DEFINE MAIL [ <oMail> ];
[ SUBJECT <cSubject> ];
[ TEXT <cText> ];
[ TYPE <cType> ];
[ DATE <dDate> ];
[ TIME <cTime> ];
[ CONVERSATION <cConversation> ]:
[ RECEIPT ];
[ FROM USER ];
[ FILES <cFilename1> ,<cDescript1>, <cFilenameN>, <cDescriptN> ] ];
[ ORIGIN <cOrigin> [ <cOriginAddress> ] ];
[ TO <cTarget1>, [ <cTargetAddress1> ] [ <cTargetN> [ <cTargetAddressN> ] ] ];
FILES
When specifying an attachment file you must include the path and a description. Use a two dimensonal array, the first element is the filename with path, the second is the description. You can have multiple files by adding more elements.
aFiles:={"c:\my docments\mydoc.doc","mydoc.doc"}
If the attachment file is html (has a .htm or .html extension) and you do not specify any TEXT (a message) then the file will appear in the message area.
ERRORS
If you specify a TO and the parameter is blank and you are using the FROM USER clause, the message compose box will not appear. Likewise if the filename is invalid or not found. It is best to use an error trap:
DEFINE MAIL...
ACTIVATE MAIL...
IF oMail:nRetCode!=0
MsgAlert("The message could not be sent due to an error."+CRLF+;
"MAPI error code: "+ltrim(str(oMail:nRetCode)),"Alert")
ENDIF