Open abhi18av opened 6 years ago
I've since made attempts to use postal
with Amazon SES
as well and here's the code for that
(ns hello-from-devnagri.scratch-postal
(:require [postal.core :refer [send-message]]))
;; AWS
(def host "email-smtp.us-east-1.amazonaws.com")
(def user "AKIAJ....")
(def pass "AuP....")
(def conn {
:user user
:pass pass
:host host
;:ssl true
:port 587
})
(send-message conn
{:from "abhinav@fourtek.com"
:to "abhinav@fourtek.com"
:subject "Hi!"
:body "Test."})
Unfortunately, with this I get the following error
2. Unhandled java.net.UnknownHostException
linux-1s35: linux-1s35: Name or service not known
InetAddress.java: 1505 java.net.InetAddress/getLocalHost
support.clj: 73 postal.support/hostname
support.clj: 73 postal.support/hostname
support.clj: 78 postal.support/message-id
support.clj: 76 postal.support/message-id
message.clj: 175 postal.message/make-jmessage/fn
nil: -1 postal.message.proxy$javax.mail.internet.MimeMessage$ff19274a/updateMessageID
MimeMessage.java: 2200 javax.mail.internet.MimeMessage/updateHeaders
nil: -1 postal.message.proxy$javax.mail.internet.MimeMessage$ff19274a/updateHeaders
MimeMessage.java: 2159 javax.mail.internet.MimeMessage/saveChanges
nil: -1 postal.message.proxy$javax.mail.internet.MimeMessage$ff19274a/saveChanges
message.clj: 190 postal.message/make-jmessage
message.clj: 156 postal.message/make-jmessage
smtp.clj: 34 postal.smtp/smtp-send*/fn
core.clj: 2747 clojure.core/map/fn
LazySeq.java: 40 clojure.lang.LazySeq/sval
LazySeq.java: 49 clojure.lang.LazySeq/seq
RT.java: 528 clojure.lang.RT/seq
core.clj: 137 clojure.core/seq
core.clj: 137 clojure.core/seq
smtp.clj: 35 postal.smtp/smtp-send*
smtp.clj: 29 postal.smtp/smtp-send*
smtp.clj: 58 postal.smtp/smtp-send
smtp.clj: 39 postal.smtp/smtp-send
RestFn.java: 423 clojure.lang.RestFn/invoke
core.clj: 35 postal.core/send-message
core.clj: 29 postal.core/send-message
REPL: 42 hello-from-devnagri.scratch-postal/eval10697
REPL: 42 hello-from-devnagri.scratch-postal/eval10697
Compiler.java: 7062 clojure.lang.Compiler/eval
Compiler.java: 7025 clojure.lang.Compiler/eval
core.clj: 3206 clojure.core/eval
core.clj: 3202 clojure.core/eval
main.clj: 243 clojure.main/repl/read-eval-print/fn
main.clj: 243 clojure.main/repl/read-eval-print
main.clj: 261 clojure.main/repl/fn
main.clj: 261 clojure.main/repl
main.clj: 177 clojure.main/repl
RestFn.java: 1523 clojure.lang.RestFn/invoke
interruptible_eval.clj: 87 clojure.tools.nrepl.middleware.interruptible-eval/evaluate/fn
AFn.java: 152 clojure.lang.AFn/applyToHelper
AFn.java: 144 clojure.lang.AFn/applyTo
core.clj: 657 clojure.core/apply
core.clj: 1965 clojure.core/with-bindings*
core.clj: 1965 clojure.core/with-bindings*
RestFn.java: 425 clojure.lang.RestFn/invoke
interruptible_eval.clj: 85 clojure.tools.nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 55 clojure.tools.nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 222 clojure.tools.nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
interruptible_eval.clj: 190 clojure.tools.nrepl.middleware.interruptible-eval/run-next/fn
AFn.java: 22 clojure.lang.AFn/run
ThreadPoolExecutor.java: 1149 java.util.concurrent.ThreadPoolExecutor/runWorker
ThreadPoolExecutor.java: 624 java.util.concurrent.ThreadPoolExecutor$Worker/run
Thread.java: 748 java.lang.Thread/run
1. Caused by java.net.UnknownHostException
linux-1s35: Name or service not known
Inet6AddressImpl.java: -2 java.net.Inet6AddressImpl/lookupAllHostAddr
InetAddress.java: 928 java.net.InetAddress$2/lookupAllHostAddr
InetAddress.java: 1323 java.net.InetAddress/getAddressesFromNameService
InetAddress.java: 1500 java.net.InetAddress/getLocalHost
support.clj: 73 postal.support/hostname
support.clj: 73 postal.support/hostname
support.clj: 78 postal.support/message-id
support.clj: 76 postal.support/message-id
message.clj: 175 postal.message/make-jmessage/fn
nil: -1 postal.message.proxy$javax.mail.internet.MimeMessage$ff19274a/updateMessageID
MimeMessage.java: 2200 javax.mail.internet.MimeMessage/updateHeaders
nil: -1 postal.message.proxy$javax.mail.internet.MimeMessage$ff19274a/updateHeaders
MimeMessage.java: 2159 javax.mail.internet.MimeMessage/saveChanges
nil: -1 postal.message.proxy$javax.mail.internet.MimeMessage$ff19274a/saveChanges
message.clj: 190 postal.message/make-jmessage
message.clj: 156 postal.message/make-jmessage
smtp.clj: 34 postal.smtp/smtp-send*/fn
core.clj: 2747 clojure.core/map/fn
LazySeq.java: 40 clojure.lang.LazySeq/sval
LazySeq.java: 49 clojure.lang.LazySeq/seq
RT.java: 528 clojure.lang.RT/seq
core.clj: 137 clojure.core/seq
core.clj: 137 clojure.core/seq
smtp.clj: 35 postal.smtp/smtp-send*
smtp.clj: 29 postal.smtp/smtp-send*
smtp.clj: 58 postal.smtp/smtp-send
smtp.clj: 39 postal.smtp/smtp-send
RestFn.java: 423 clojure.lang.RestFn/invoke
core.clj: 35 postal.core/send-message
core.clj: 29 postal.core/send-message
REPL: 42 hello-from-devnagri.scratch-postal/eval10697
REPL: 42 hello-from-devnagri.scratch-postal/eval10697
Compiler.java: 7062 clojure.lang.Compiler/eval
Compiler.java: 7025 clojure.lang.Compiler/eval
core.clj: 3206 clojure.core/eval
core.clj: 3202 clojure.core/eval
main.clj: 243 clojure.main/repl/read-eval-print/fn
main.clj: 243 clojure.main/repl/read-eval-print
main.clj: 261 clojure.main/repl/fn
main.clj: 261 clojure.main/repl
main.clj: 177 clojure.main/repl
RestFn.java: 1523 clojure.lang.RestFn/invoke
interruptible_eval.clj: 87 clojure.tools.nrepl.middleware.interruptible-eval/evaluate/fn
AFn.java: 152 clojure.lang.AFn/applyToHelper
AFn.java: 144 clojure.lang.AFn/applyTo
core.clj: 657 clojure.core/apply
core.clj: 1965 clojure.core/with-bindings*
core.clj: 1965 clojure.core/with-bindings*
RestFn.java: 425 clojure.lang.RestFn/invoke
interruptible_eval.clj: 85 clojure.tools.nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 55 clojure.tools.nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 222 clojure.tools.nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
interruptible_eval.clj: 190 clojure.tools.nrepl.middleware.interruptible-eval/run-next/fn
AFn.java: 22 clojure.lang.AFn/run
ThreadPoolExecutor.java: 1149 java.util.concurrent.ThreadPoolExecutor/runWorker
ThreadPoolExecutor.java: 624 java.util.concurrent.ThreadPoolExecutor$Worker/run
Thread.java: 748 java.lang.Thread/run
@abhi18av With Amazon SES, :tls
flag may be required.
(def conn {
:user user
:pass pass
:host host
:tls true ;; <-- may be required
:port 587
})
c.f. https://github.com/drewr/postal#encryption-gmail-example
I have the same error with gmail on aws: Please log in via 534-5.7.14 your web browser and then try again.
Hi @abhi18av. from what I gathered Google has moved from SSL to TLS for their smtp service.
I have suggested a documentation update to help others: #105
Many thanks @poenneby for tracking this down and updating the docs!
I think we could also add some helpers in Postal for popular services like Gmail and SES. If someone would like to work on that, please do.
Hi, is this issue resolved? I am still getting similar error logs while I am using correct tls/ssl ports as per gmail support docs.
Hi @drewr
I am trying to use this library to send messages via my
gmail
account to anothergmail
account.Here's the sample code I've used from the
ReadMe
But so far, I keep running into authentication error
Could you kindly please help me out here ?