Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Send Email from X# 06 Sep 2022 12:05 #23668

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


  • Posts: 177
  • Hello everyone,
    to send emails from my applications I use the System.Net.Mail.SmtpClient class for non-SSL emails and port 25, I use CDO.Message for SSL emails and on port 465. I would like to get rid of the ADODB.dll and cdosys DLLs .dll, but I can't find a solution except by resorting to third-party tools that I would like to avoid. Any suggestions?
    Thank you
    Danilo

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

    Send Email from X# 06 Sep 2022 12:14 #23671

    • wriedmann
    • wriedmann's Avatar


  • Posts: 3297
  • Hi Danilo,
    Ciao Danilo,
    System.Net.Mail.SmtpClient e System.Net.Mail.MailMessage are your friends.
    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.

    Send Email from X# 06 Sep 2022 12:20 #23672

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


  • Posts: 177
  • Thanks Wolfgang,
    I did this too but System.Net.Mail.SmtpClient has been marked as Obsolete for a while,

    Danilo

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

    Send Email from X# 06 Sep 2022 13:45 #23674

    • wriedmann
    • wriedmann's Avatar


  • Posts: 3297
  • Hi Danilo,
    is is marked as obsolete only for Xamarin.
    I'm not sure if it is worth to use an open source library like MimeKit: www.mimekit.net/
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

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

    Send Email from X# 06 Sep 2022 17:45 #23677

    • ic2
    • ic2's Avatar


  • Posts: 1608
  • Hello Wolfgang,

    is is marked as obsolete only for Xamarin.

    That's true but it also says: SmtpClient doesn't support many modern protocols.

    In fact it only supports SMTP. If that is enough for Danilo's requirements, then it's fine, but if it is needs to be flexible probably not.

    See also

    docs.microsoft.com/en-us/dotnet/api/syst...ablessl?view=net-6.0
    jonathancrozier.com/blog/smtpclient-is-o...ls-from-your-net-app
    github.com/dnnsoftware/Dnn.Platform/issues/3120

    Normally I welcome it when Microsoft declares something obsolete, which means that they can't further ruin it as they usually do. But for this class I can imagine a ISP or mailserver which requires some security protocol which won't work then.

    We use Chilkat for mail and many other things and this works very well..

    Dick

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

    • Page:
    • 1