Welcome, Guest
Username: Password: Remember me
Qui si parla italiano
  • Page:
  • 1

TOPIC:

Invia Email dal X# 06 Sep 2022 12:07 #23669

  • softdevo@tiscali.it's Avatar
  • Topic Author


  • Posts: 177
  • Ciao a tutti,
    per inviare email dalle mie applicazioni utilizzo la classe System.Net.Mail.SmtpClient per email non SSL e porta 25, uso CDO.Message per email SSL e su porta 465. Io vorrei liberarmi dalle DLL ADODB.dll e cdosys.dll, ma non trovo soluzione se non ricorrendo a strumenti di terze parti che vorrei evitare.
    Qualche suggerimento?
    Grazie
    Danilo

    Please Log in or Create an account to join the conversation.

    Invia Email dal X# 06 Sep 2022 12:13 #23670

    • wriedmann
    • wriedmann's Avatar


  • Posts: 3366
  • Ciao Danilo,
    System.Net.Mail.SmtpClient e System.Net.Mail.MailMessage sono i tuoi amici.
    oMessage			:= MailMessage{}
    	oMessage:Subject	:= cSubject
    	oMessage:Body		:= cMailBody
    	oMessage:Sender		:= MailAddress{ _cSender }
    	oMessage:@@From		:= MailAddress{ _cSender }
    	oMessage:@@to:Add( cAddress )
    
    	System.Net.ServicePointManager.SecurityProtocol := System.Net.SecurityProtocolType.Tls12
    	oSmtpClient			:= SmtpClient{}
    	oSmtpClient:Host	:= _cServerName
    	oSmtpClient:Port	:= _nPortNumber
    	oSmtpClient:DeliveryMethod := SmtpDeliveryMethod.Network
    	if _cUserName:Length > 1
    		oSmtpClient:UseDefaultCredentials	:= false
    		oSmtpClient:Credentials	:= NetworkCredential{ _cUserName, _cPassword }
    	endif
    	if _lUseSSL
    		oSmtpClient:EnableSsl		:= true
    	endif
    	oSmtpClient:Send( oMessage )
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1
    Moderators: wriedmann