FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour To send email with image
Posts: 49
Joined: Thu Dec 22, 2005 12:50 PM
To send email with image
Posted: Wed Aug 09, 2006 12:36 PM

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

Fwh906

Brazil
Posts: 49
Joined: Thu Dec 22, 2005 12:50 PM
To send email with image
Posted: Wed Aug 09, 2006 02:44 PM

please

Kleyton

Fwh906

Brazil
Posts: 49
Joined: Thu Dec 22, 2005 12:50 PM
To send email with image
Posted: Thu Aug 10, 2006 02:46 PM

Help, please !!!

Kleyton

Fwh906

Brazil
Posts: 114
Joined: Tue Feb 14, 2006 08:13 AM
Re: To send email with image
Posted: Thu Aug 10, 2006 04:41 PM
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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
To send email with image
Posted: Thu Aug 10, 2006 05:01 PM
Kleyton,
oMailItem:Set( "HTMLBody", '<HTML><HEAD></HEAD><BODY><img src="http://www.fivetechsoft.com/images/logo5t2.gif"</BODY></HTML>' )
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
To send email with image
Posted: Thu Aug 10, 2006 05:17 PM

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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 253
Joined: Fri Feb 03, 2006 04:21 PM
To send email with image
Posted: Fri Nov 10, 2006 09:08 PM

DEFINE MAIL

com incredimail não aparece o texto corretamente

www.incredimail.com

Ari

Thanks,
Ari

FWH 2501 - Harbour 3.2.0 - Embarcadero 7.43 - MySQL
São Paulo - SP - Brasil
www.sisrev.com.br

Continue the discussion