Heyho everybody! I am building a web application in and recently wanted to start implementing features that involve sending mails (password-reset functionality).
Nim has std/smtp for this with really neat examples for using both `starttls` and `ssl`, however I can't seem to get them to work despite sticking to them as closely as I could. For that purpose I created a dummy mail address on a local mail service provider (<https://hilfe.web.de/pop-imap/pop3/serverdaten.html> \- Careful, loads of spam) to play around a bit and can't get it to work, despite following the examples as closely as I could. Here the code I used: import std/[smtp] let smtpServerName = "smtp.web.de" let startTlsportNumber = 587 let un = "dummymail" # replace with actual username let pw = "dummypw" # replace with actual pw let target = "b...@mailinator.com" #StartTLS code block - Have either this or the SSL code block commented in, not both let smtpConn = newSmtp(debug=true) smtpConn.connect(smtpServerName, Port startTlsportNumber) smtpConn.startTls() #SSL code block - Have either this or the startTLS code block commented in, not both # let sslPortNumber = 465 # let smtpConn = newSmtp(useSsl = true, debug=true) # smtpConn.connect(smtpServerName, Port sslPortNumber) var msg = createMessage(mSubject = "Hello from Nim's SMTP", mBody = "Hello!.\n Is this awesome or what?", mTo = @[target]) smtpConn.auth(un, pw) smtpConn.sendmail(un, @[target], $msg) Run With startTLS this causes a runtime error as the web.de server sends back a 503 response on `smtpConn.startTls`: > Error: unhandled exception: Expected 220 reply, got: 503 Bad sequence of > commands [ReplyError] With SSL this causes a runtime error as the web.de server sends back a 503 response on `smtpConn.connect`: > `Error: unhandled exception: Expected 250 reply, got: 503 Bad sequence of > commands [ReplyError]` I've triple checked the ports, the service provider states explicitly that 587 is the port for startTls and 465 for SSL. I compile on Arch Linux with `-d:ssl` in both cases, so that shouldn't be an issue either (and also that would be a compile-time error in that scenario, wouldn't it?). Googling the error for a bit and looking at other questions of other programming languages, the error seems to be related to authentication? Which is weird, because I thought authentication starts with my login credentials after I made the connection secure with startTls. This looks to me like I'm using the std/smtp library wrong, but I don't quite see where. Does anyone here see the issue?