Closed ShaunLeMouton closed 11 months ago
The smtp server doesn't actually send emails. It receives them. Once it receives them you can chose what to do with the email message.
If you just want to send an email to yourself use MailKit and send an email via your ISP or mail provider.
If you want to use the server as a relay you need to actually write the code to ship off the email, again using MailKit.
Thanks for the answer. I was a little bit confused.
I won't use a ISP or mail provider.
Yes I want to use the server as a relay to send emails as a client to smtp server. Ther server receive the mail and relay them to as example to gmail or other adresses. Do you have some MailKit example to relay mails?
Create direct query against recipient MX server and send email direct using MailKit. We use this repo (thanks to the developer) and build distributed mail server for our own platform. So far it's been working great. (Except minor issues with teh SSL part which I may send through a request/question later)
Send email direct without ISP/mail provider is quite simple though:
https://www.emailarchitect.net/easendmail/sdk/html/dnslookup.htm
https://www.limilabs.com/blog/send-email-without-smtp-server-dns-lookup
Code snippet from Limilabs (which is another great open source mail server vendor) is very clear and straight forward, you don't have to use their component to do the query and send message. Just open source DnsClient.NET for query, and MailKit for sending email will be just fine.
Good luck
Closing this now.
I used the sample project and I use the following code to start the server:
SimpleServerExample.Run();
then I send a message to the server via my smtpClient (I used the sample mail client) the server give the following answers:
but I did not receive any mail at xofowkwjthwk@lambsauce.de
I don't no why. Does someone else have the same problem or/and know how to solve it?