by ukservice » Sun Oct 31, 2010 10:29 am
Timm
I suggest you this sample from asnker:
#Include "FiveWin.ch"
Function Main()
Local oEmailCfg,oEmailMsg
TRY
oEmailCfg := CREATEOBJECT( "CDO.Configuration" )
WITH OBJECT oEmailCfg:Fields
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserver" ):Value := "mail.xxxxxxxx.com"
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpserverport" ):Value := 25
:Item( "http://schemas.microsoft.com/cdo/configuration/sendusing" ):Value := 2 // Remote SMTP = 2, local = 1
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" ):Value := .T.
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpusessl" ):Value := .F.
:Item( "http://schemas.microsoft.com/cdo/configuration/sendusername" ):Value := "xxanser@xxxxxxxx.com"
:Item( "http://schemas.microsoft.com/cdo/configuration/sendpassword" ):Value := "xxxxxx"
:Item( "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"):Value := 30
:Update()
END WITH
CATCH oError
MsgInfo( "Could not create message configuration" + ";" + ;
"Error: " + TRANSFORM(oError:GenCode, NIL) + ";" + ;
"SubC: " + TRANSFORM(oError:SubCode, NIL) + ";" + ;
"OSCode: " + TRANSFORM(oError:OsCode, NIL) + ";" + ;
"SubSystem: " + TRANSFORM(oError:SubSystem, NIL) + ";" + ;
"Message: " + oError:Description )
Return .F.
END
oError:=NIL
TRY
oEmailMsg := CREATEOBJECT ( "CDO.Message" )
WITH OBJECT oEmailMsg
:Configuration = oEmailCfg
:From = chr(34)+" Anser K.K. "+chr(34)+ "<anser@xxxxxxxx.com>" // This will be displayed in the From (The email id does not appear)
:To = "xxanserkk@xxxxx.com" // <----- Place the TO email address
:Subject = "This is a Tst message"
:ReplyTo = "xxanser@xxxxxxxxx.com"
:Sender = "xxanser@xxxxxxxxx.com" // Read Receipt message is send to this
:Organization = "My xxxxxx Company" // "My Company Name"
:HTMLBody = "<HTML> Hello </HTML>"
:Send()
END WITH
SysRefresh()
CATCH oError
MsgInfo( "Could not send message" + ";" + CRLF+ ;
"Error: " + TRANSFORM(oError:GenCode, NIL) + ";" + CRLF+;
"SubC: " + TRANSFORM(oError:SubCode, NIL) + ";" + CRLF+ ;
"OSCode: " + TRANSFORM(oError:OsCode, NIL) + ";" + CRLF +;
"SubSystem: " + TRANSFORM(oError:SubSystem, NIL) + ";" +CRLF+ ;
"Message: " + oError:Description )
Return .F.
END
MsgInfo("Email Send")
Return
FWH 11.11, Harbour 3.1 and Borland C++ 5.82