-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathmailspec.scala
More file actions
24 lines (21 loc) · 860 Bytes
/
Copy pathmailspec.scala
File metadata and controls
24 lines (21 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package courier
import scala.concurrent.Await
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._
class MailSpec extends munit.FunSuite {
// create a gmail app password https://myaccount.google.com/apppasswords
test("the mailer should send an email".ignore) { // remove .ignore to run the test locally
val email = sys.env("IT_EMAIL")
val password = sys.env("IT_PASSWORD")
val mailer = Mailer("smtp.gmail.com", 587)
.debug(true)
.auth(true)
.as(email, password)
.startTls(true)()
val mId = Await.result(mailer(Envelope.from(email.addr)
.to(email.addr)
.subject("miss you")
.content(Text("hi mom"))), 10.seconds)
assert(mId.nonEmpty, "Message-ID should be set by the Transport.send call")
}
}