Nim icon indicating copy to clipboard operation
Nim copied to clipboard

Ubuntu 20.04 + Nim v2.0 + smtp = No valid socket error code available

Open ThomasTJdev opened this issue 1 year ago • 2 comments

Description

Very basic code example sending emails works fine - besides when being deployed on Ubuntu 20.04.

Info

  • Using Nim v2.0.2
  • Using the official smtp package
  • Running on Ubuntu 20.04
  • Connecting to AWS SES

Code snippet Identical to the mail code example.

var msg = createMessage("Hello from Nim's SMTP",
                        "Hello!.\n Is this awesome or what?",
                        @["[email protected]"])
let smtpConn = newSmtp(useSsl = true, debug=true)
smtpConn.connect("smtp.gmail.com", Port 465)
smtpConn.auth("username", "password")
smtpConn.sendmail("[email protected]", @["[email protected]"], $msg)

Nim Version

# Ubuntu 20.04 - not working env

$ openssl version
OpenSSL 1.1.1f  31 Mar 2020

$ nim -v
Nim Compiler Version 2.0.2 [Linux: amd64]
Compiled at 2023-12-15
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: c4c44d10df8a14204a75c34e499def200589cb7c
active boot switches: -d:release

Current Output

$ nim c -d:dev -d:ssl -r email_test.nim
/home/user/tmp/email_test.nim(6) email_test
/home/user/.nimble/pkgs/smtp-0.1.0/smtp.nim(267) connect
/home/user/.nimble/pkgs/smtp-0.1.0/smtp.nim(227) checkReply
/home/user/.nimble/pkgs/smtp-0.1.0/smtp.nim(109) debugRecv
/home/user/.choosenim/toolchains/nim-2.0.2/lib/pure/net.nim(1654) recvLine
/home/user/.choosenim/toolchains/nim-2.0.2/lib/pure/net.nim(1602) readLine
/home/user/.choosenim/toolchains/nim-2.0.2/lib/pure/net.nim(941) getSocketError
/home/user/.choosenim/toolchains/nim-2.0.2/lib/std/oserrors.nim(92) raiseOSError
Error: unhandled exception: Additional info: No valid socket error code available [OSError]

Expected Output

No response

Possible Solution

No response

Additional Information

No response

ThomasTJdev avatar Jan 21 '24 09:01 ThomasTJdev