Help Integrating email service in .NET

Hello everybody I need some help in integrating emails sending service into my .net ASP API I’m new to this and I don’t know how to implement this and what is best email service? And can I do this implementation for free or not?
13 Replies
DΣX
DΣX3w ago
sendgrid seems to be the most popular one. its free up to a certain usage limit and u can just use an smtp client, which is available in dotnet afaik
DΣX
DΣX3w ago
SendGrid
Pricing and Plans
Sign up to send transactional and marketing email. All of our plans are backed by our industry-leading deliverability, reliability, and support.
DΣX
DΣX3w ago
SmtpClient Class (System.Net.Mail)
Sends email by using the Simple Mail Transfer Protocol (SMTP). The SmtpClient type is not recommended for new development; for more information, see the Remarks section.
v0fbu1vm
v0fbu1vm3w ago
Mailkit is really awsome aswell.
wasabi
wasabi3w ago
Clarification: Mailkit isn't a sending service. It's a client library. It is not required for SendGrid.
Thalnos
Thalnos3w ago
System.Net.Mail.SmtpClient is deprecated and should no longer be used. It is suggested to use a library such as Mailkit
Thalnos
Thalnos3w ago
No description
Thalnos
Thalnos3w ago
No description
Thalnos
Thalnos3w ago
besides the connection lifecycle other issue is that it doesnt support modern authentication and security protocols - OAuth2, DKIM, DMARC and SPF are all not supported but they are in libraries like Mailkit
DΣX
DΣX3w ago
i mean... microsoft would probably have no problem giving this to a dev and say 'clean up that mess'. but they are not doing it. because. 🙈 im still using it for mails, as it is so simple to use, and comes for free in the base powershell (using send-mailmessage). other than needing to allow for some newer tls ([System.Net.ServicePointManager]::SecurityProtocol = 'Tls,TLS11,TLS12') it didnt let me down yet. In the end, as always, the answer to whether you should or want to use it is: 'it depends' (on the scale and usecase of your project, and whether simplicity wins over the additional effort of using an external library (or module in my case))
No description
Thalnos
Thalnos3w ago
The issues with it‘s weird lifecycle and midsing support for OAuth, DKIM, DMARC and SPF remain It’s missing the new protocols commonly used for mails and the api is generally poorly written regarding the connection lifecycle Described here You can neither wrap it in a using to dispose off the connection, nor can you reuse it cuz it ain’t Thread safe
DΣX
DΣX3w ago
yeah, ive read that. and its all good. your right. just saying it may still work for certain usecases.
walidmostafa77
walidmostafa77OP2w ago
Currently I did it through Gmail SMTP and when I buy the domain I will get an email from Hostinger but I don't know currently how to connect it and send through it I use net.mail And it working also my ASP API is very simple So as u say i should to change it to mailkit or not?

Did you find this page helpful?