Franz,
mit Windows kann auch ein OLE-Object für den Mailversand genutzt werden. Damit ist auch SSL und ExchangeServer möglich.
Nachfolgend etwas Beispielcode - da sind einige Textstellen für verschiedene Optionen ausmarkiert. Habe ich nicht vollständig getestet - funktioniert aber für 'normale' Mail problemlos.
Weitere Infos dazu findest Du bei google.
HTH
Gerhard Bunzel
FUNCTION CDOSendMail (cFrom AS STRING, cTo AS STRING, cSmtp AS STRING, cUserID AS STRING, cPwd AS STRING, dPort AS DWORD, lSSL AS LOGIC, cSubject AS STRING, cBody AS STRING) AS LOGIC PASCAL
LOCAL objMessage AS OBJECT
LOCAL objConfiguration AS OBJECT
LOCAL cdoSendUsingPickup AS DWORD
LOCAL cdoSendUsingPort AS DWORD
LOCAL cdoAnonymous AS DWORD
LOCAL cdoBasic AS DWORD
LOCAL cdoNTLM AS DWORD
//LOCAL cHtml AS STRING
cdoSendUsingPickup := 1 // Send message USING the LOCAL SMTP service pickup directory
cdoSendUsingPort := 2 // Send the message USING the network (SMTP over the network)
cdoAnonymous := 0 // DO not authenticate
cdoBasic := 1 // basic (clear-TEXT) authentication
cdoNTLM := 2 // NTLM - If you are using Exchange Server on a Domain, you may require NTLM (2).
objMessage := OLEAutoObject{"CDO.Message"}
objConfiguration := objMessage:Configuration
// IF you are running Exchange Server, you may need to use 3 (SendUsingExchange).
// 2-SendUsingPort 3-SendUsingExchange 1-SendUsingPickup
objConfiguration:Fields:[Item, "
http://schemas.microsoft.com/cdo/config ... /sendusing"] := 2
// Name or IP OF Remote SMTP Server
objConfiguration:Fields:[Item, "
http://schemas.microsoft.com/cdo/config ... smtpserver"] := cSmtp
// objConfiguration:Fields:[Item, "
http://schemas.microsoft.com/cdo/config ... ccountname"] := cAcctName
// objConfiguration:Fields:[Item, "
http://schemas.microsoft.com/cdo/config ... ailaddress"] := cSMTPEmail
// Type OF authentication, NONE, Basic (Base64 encoded), NTLM
objConfiguration:Fields:[Item, "
http://schemas.microsoft.com/cdo/config ... thenticate"] := cdoBasic
//objMessage:Configuration:Fields:[Item, "
http://schemas.microsoft.com/cdo/config ... thenticate"] := NONE
// Your UserID on the SMTP server
objConfiguration:Fields:[Item, "
http://schemas.microsoft.com/cdo/config ... ndusername"] := cUserID
// Your password on the SMTP server
objConfiguration:Fields:[Item, "
http://schemas.microsoft.com/cdo/config ... ndpassword"] := cPwd
// Server port (typically 25 - with SSL: 465 )
objConfiguration:Fields:[Item, "
http://schemas.microsoft.com/cdo/config ... serverport"] := dPort
// Use SSL FOR the connection (FALSE or TRUE)
objConfiguration:Fields:[Item, "
http://schemas.microsoft.com/cdo/config ... smtpusessl"] := lSSL
// Connection Timeout in Seconds (the maximum time CDO will try TO establish a connection TO the SMTP server)
objConfiguration:Fields:[Item, "
http://schemas.microsoft.com/cdo/config ... iontimeout"] := 60
objConfiguration:Fields:Update()
// oCDOMsg:Configuration := oCDOConf
// objMessage:BodyPart:Charset := "utf-8"
objMessage:Subject := cSubject
objMessage:From := cFrom
objMessage:@@TO := cTo
// IVarPut(objMessage,#TO,cTo)
// oMsg.CC = cCC
// oMsg.BCC = cBCC
objMessage:TextBody := cBody
/***** To send HTML body, uncomment the following lines:
cHtml := "<HTML>n" + ;
"<HEAD>n" + ;
"<TITLE>Sample GIF</TITLE>n" + ;
"</HEAD>n" + ;
"<BODY><P>n" + ;
"<h1><Font Color=Green>Inline graphics</Font></h1>n" + ;
"</BODY>n" + ;
"</HTML>"
oder:
<HTML>
<HEAD>
<TITLE>Example</TITLE>
</HEAD>
</BODY>
<DIV>
<IMG SRC="file://D:/some/path/image.jpg">
</DIV>
</BODY>
</HTML>
objMessage:HTMLBody := cHtml
***********/
/**** To send WEB page in an e-mail, uncomment the following lines and make changes in TODO section.
TODO: Replace with your preferred Web page
CreateMHTMLBody(
BSTR URL,
CdoMHTMLFlagsFlags=cdoSuppressNone,
BSTR UserName,
BSTR Password)
CdoSuppressNone := 0 Download all resources referred to in elements within the resource at the specified Uniform Resource Identifier (URI) (not recursive).
oMsg.CreateMHTMLBody("
http://www.microsoft.com", CDO.CdoMHTMLFlags.cdoSuppressNone, "", "")
oMsg.Subject = "Test SMTP"
**********/
objMessage:AddAttachment( "D:MyTestDokument1.pdf" )
// objMessage:AddAttachment( cDokument2 )
objMessage:Send()
objMessage:Destroy()
RETURN TRUE