drewr / postal

Clojure email support
MIT License
587 stars 85 forks source link

Send more than one message over same connection #61

Open lgrapenthin opened 9 years ago

lgrapenthin commented 9 years ago

Apparently smtp-send can do this, but send-message can't. Is smtp-send part of the public API?

rafd commented 5 years ago

I was getting 454 4.7.0 Too many login attempts, please try again later when trying to send many emails through Gmail via SMTP. I was going to check if postal supported SMTP pooling, which, it effectively does via postal.smtp/smtp-send.

If anyone else runs into this, you can use postal.smtp/smtp-send instead of postal.core/send-message. To send multiple, you simply include multiple arguments after the config, ex:

(postal.smtp/smtp-send {:host "..." :user "..."  :pass ""}  {:from "..." :to "..."} {:from "..." :to "..."})

If your messages are in a list, you will want to use apply:

(apply postal.smtp/smtp-send {:host "..." :user "..."  :pass ""} messages-list)