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
Send Email from X#
Send Email from X#
Hi Danilo,
Ciao Danilo,
System.Net.Mail.SmtpClient e System.Net.Mail.MailMessage are your friends.
Wolfgang
Ciao Danilo,
System.Net.Mail.SmtpClient e System.Net.Mail.MailMessage are your friends.
Code: Select all
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 Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
- softdevo@tiscali.it
- Posts: 191
- Joined: Wed Sep 30, 2015 1:30 pm
Send Email from X#
Thanks Wolfgang,
I did this too but System.Net.Mail.SmtpClient has been marked as Obsolete for a while,
Danilo
I did this too but System.Net.Mail.SmtpClient has been marked as Obsolete for a while,
Danilo
Send Email from X#
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: http://www.mimekit.net/
Wolfgang
is is marked as obsolete only for Xamarin.
I'm not sure if it is worth to use an open source library like MimeKit: http://www.mimekit.net/
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Send Email from X#
Hello Wolfgang,
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
https://docs.microsoft.com/en-us/dotnet ... ew=net-6.0
https://jonathancrozier.com/blog/smtpcl ... ur-net-app
https://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
That's true but it also says: SmtpClient doesn't support many modern protocols.wriedmann post=23674 userid=336 wrote:is is marked as obsolete only for Xamarin.
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
https://docs.microsoft.com/en-us/dotnet ... ew=net-6.0
https://jonathancrozier.com/blog/smtpcl ... ur-net-app
https://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