Skip to content

Commit

Permalink
Merge pull request #571 from eichholz/reply-to
Browse files Browse the repository at this point in the history
Add support for Reply-To mail header
  • Loading branch information
eikek authored Feb 13, 2024
2 parents 04e1341 + aeedbb1 commit 7a680b1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
target/
local/
_site/
result
result
.bloop
project/**/project
metals.sbt
.vscode
.metals
.bsp
7 changes: 7 additions & 0 deletions modules/common/src/main/scala/emil/builder/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ package builder {
mail.mapMailHeader(_.mapRecipients(_.addBccs(mas)))
}

case class ReplyTo[F[_]](ma: MailAddress) extends Trans[F] {
def apply(mail: Mail[F]): Mail[F] =
mail.mapMailHeader(_.copy(replyTo = Some(ma)))
}

object ReplyTo extends MailAddressHelper[ReplyTo]

case class Subject[F[_]](text: String) extends Trans[F] {
def apply(mail: Mail[F]): Mail[F] =
mail.mapMailHeader(_.withSubject(text))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ trait BasicEncode {
Message.RecipientType.BCC,
header.recipients.bcc.map(ca.convert).map(a => a.asInstanceOf[Address]).toArray
)
msg.setReplyTo(
header.replyTo.map(ca.convert).map(a => a.asInstanceOf[Address]).toArray
)

if (header.flags.nonEmpty) {
val flags = new Flags()
Expand Down

0 comments on commit 7a680b1

Please sign in to comment.