Page 1 of 1

To send email with image

PostPosted: Wed Aug 09, 2006 12:36 pm
by Kleyton
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

PostPosted: Wed Aug 09, 2006 2:44 pm
by Kleyton
please

PostPosted: Thu Aug 10, 2006 2:46 pm
by Kleyton
Help, please !!!

Re: To send email with image

PostPosted: Thu Aug 10, 2006 4:41 pm
by E. Bartzokas
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


Kleyton,
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

PostPosted: Thu Aug 10, 2006 5:01 pm
by Antonio Linares
Kleyton,
Code: Select all  Expand view
oMailItem:Set( "HTMLBody", '<HTML><HEAD></HEAD><BODY><img src="http://www.fivetechsoft.com/images/logo5t2.gif"</BODY></HTML>' )

PostPosted: Thu Aug 10, 2006 5:17 pm
by James Bott
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

PostPosted: Fri Nov 10, 2006 9:08 pm
by Ari
DEFINE MAIL

com incredimail não aparece o texto corretamente

www.incredimail.com

Ari