mail-notify: handle mails without subject
This commit is contained in:
parent
5339476c09
commit
6ab807af59
|
@ -18,6 +18,8 @@ def from(msg: MimeMessage): String =
|
|||
.map(addr => Option(addr.getPersonal).map(_.replace("&", "&")).getOrElse(addr.getAddress))
|
||||
.getOrElse("unknown")
|
||||
|
||||
def subject(msg: MimeMessage): String =
|
||||
Option(msg.getSubject).map(_.replace("&", "&")).getOrElse("")
|
||||
|
||||
case class MailInfo(from: String, subject: String, mailbox: String)
|
||||
object MailInfo:
|
||||
|
@ -26,7 +28,7 @@ object MailInfo:
|
|||
val address = msg.getFrom.head.asInstanceOf[InternetAddress]
|
||||
MailInfo(
|
||||
from(msg),
|
||||
msg.getSubject.replace("&", "&"),
|
||||
subject(msg),
|
||||
(p/up/up relativeTo maildir).toString
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue