Skip to content


gen_smtp_client connection pooling #67

seriyps opened this Issue · 1 comment

2 participants


This may be usefull, especialy for massive mail sending, to not force close TCP connection and SMTP session after email was sent via gen_smtp_client, but (optionaly) move this connection to some kind of connection pool, since SMTP allow to send many mails through one TCP connection (multiple transactions).
So, if you need to send emails to 1000 users of, eg, '', you needn't to open TCP (or maybe SSL and STARTTLS) connection for each mail, but setup pool with max 10 connections per domain and send 100 emails through each of them (transparently, no API changes required).
I'm actualy not sure about:

  • what should be the key for store/lookup connections in the pool ({Relay, TLS, SSL, Auth} or all the options from 2'nd argument of send or smth else)
  • after which timeout connection should be force-closed (see rfc5321#
  • can we use pooling with authentication, or credentials should be included in lookup key?

Any thoughts?


Or change the gen_smtp_client so it can be used in a pool (ie expose 3 functions: connect, send mail, close connection)

@seriyps seriyps closed this
@seriyps seriyps reopened this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.