Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

smtp module does not send HELO/EHLO after STARTTLS #15029

Closed
mildred opened this issue Jul 21, 2020 · 0 comments · Fixed by #15032
Closed

smtp module does not send HELO/EHLO after STARTTLS #15029

mildred opened this issue Jul 21, 2020 · 0 comments · Fixed by #15032

Comments

@mildred
Copy link
Contributor

mildred commented Jul 21, 2020

Using the provided example of the smtp module:

Example

import smtp

type
  SmtpConfig* = ref object
    server*: string
    port*: int
    user*: string
    pass*: string
    debug*: bool
    sender*: string

proc send_email(cfg: SmtpConfig, sender, recipient: string, msg: Message) =
  let smtpConn = newSmtp(debug=cfg.debug)
  let port = Port(if cfg.port == 0: 25 else: cfg.port)
  smtpConn.connect(cfg.server, port)
  #smtpConn.startTls()
  echo $cfg.user
  if cfg.user != "":
    smtpConn.auth(cfg.user, cfg.pass)
  smtpConn.sendMail(sender, @[recipient], $msg)

When STARTTLS is enabled, the smtp client fails to send EHLO once the secure connexion is established. Here is the protocol

Current Output

log:

C:HELO mailu.mildred.fr

S:250 ellomb.netlib.re
C:STARTTLS

S:220 2.0.0 Start TLS
C:AUTH LOGIN

S:334 VXNlcm5hbWU6
C:bmltbmV3c0Bib3VyZGVyaWUubWlsZHJlZC5mcg==

S:334 UGFzc3dvcmQ6
C:bmltbmV3c0Bib3VyZGVyaWUubWlsZHJlZC5mcg=

S:235 2.0.0 OK
C:MAIL FROM:<nimnews@bourderie.mildred.fr>

S:503 5.5.1 Error: send HELO/EHLO first
C:QUIT

Expected Output

EHLO after STARTTLS

Additional Information

$ nim -v
Nim Compiler Version 1.2.4 [Linux: amd64]
Compiled at 2020-06-26
Copyright (c) 2006-2020 by Andreas Rumpf

active boot switches: -d:release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant