mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-06 07:05:59 +00:00
Add cc and bcc to item mail
This commit is contained in:
parent
d62c4a5a72
commit
7052bc6b8e
@ -68,6 +68,8 @@ object OMail {
|
|||||||
item: Ident,
|
item: Ident,
|
||||||
subject: String,
|
subject: String,
|
||||||
recipients: List[MailAddress],
|
recipients: List[MailAddress],
|
||||||
|
cc: List[MailAddress],
|
||||||
|
bcc: List[MailAddress],
|
||||||
body: String,
|
body: String,
|
||||||
attach: AttachSelection
|
attach: AttachSelection
|
||||||
)
|
)
|
||||||
@ -230,6 +232,8 @@ object OMail {
|
|||||||
val fields: Seq[Trans[F]] = Seq(
|
val fields: Seq[Trans[F]] = Seq(
|
||||||
From(sett.mailFrom),
|
From(sett.mailFrom),
|
||||||
Tos(m.recipients),
|
Tos(m.recipients),
|
||||||
|
Ccs(m.cc),
|
||||||
|
Bccs(m.bcc),
|
||||||
XMailer.emil,
|
XMailer.emil,
|
||||||
Subject(m.subject),
|
Subject(m.subject),
|
||||||
TextBody[F](m.body)
|
TextBody[F](m.body)
|
||||||
|
@ -4012,6 +4012,8 @@ components:
|
|||||||
is ignored, if `addAllAttachments` is set to `true`.
|
is ignored, if `addAllAttachments` is set to `true`.
|
||||||
required:
|
required:
|
||||||
- recipients
|
- recipients
|
||||||
|
- cc
|
||||||
|
- bcc
|
||||||
- subject
|
- subject
|
||||||
- body
|
- body
|
||||||
- addAllAttachments
|
- addAllAttachments
|
||||||
@ -4021,6 +4023,14 @@ components:
|
|||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
|
cc:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
bcc:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
subject:
|
subject:
|
||||||
type: string
|
type: string
|
||||||
body:
|
body:
|
||||||
|
@ -39,11 +39,13 @@ object MailSendRoutes {
|
|||||||
def convertIn(item: Ident, s: SimpleMail): Either[String, ItemMail] =
|
def convertIn(item: Ident, s: SimpleMail): Either[String, ItemMail] =
|
||||||
for {
|
for {
|
||||||
rec <- s.recipients.traverse(MailAddress.parse)
|
rec <- s.recipients.traverse(MailAddress.parse)
|
||||||
|
cc <- s.cc.traverse(MailAddress.parse)
|
||||||
|
bcc <- s.bcc.traverse(MailAddress.parse)
|
||||||
fileIds <- s.attachmentIds.traverse(Ident.fromString)
|
fileIds <- s.attachmentIds.traverse(Ident.fromString)
|
||||||
sel =
|
sel =
|
||||||
if (s.addAllAttachments) AttachSelection.All
|
if (s.addAllAttachments) AttachSelection.All
|
||||||
else AttachSelection.Selected(fileIds)
|
else AttachSelection.Selected(fileIds)
|
||||||
} yield ItemMail(item, s.subject, rec, s.body, sel)
|
} yield ItemMail(item, s.subject, rec, cc, bcc, s.body, sel)
|
||||||
|
|
||||||
def convertOut(res: SendResult): BasicResult =
|
def convertOut(res: SendResult): BasicResult =
|
||||||
res match {
|
res match {
|
||||||
|
@ -28,6 +28,10 @@ type alias Model =
|
|||||||
, subject : String
|
, subject : String
|
||||||
, recipients : List String
|
, recipients : List String
|
||||||
, recipientsModel : Comp.EmailInput.Model
|
, recipientsModel : Comp.EmailInput.Model
|
||||||
|
, ccRecipients : List String
|
||||||
|
, ccRecipientsModel : Comp.EmailInput.Model
|
||||||
|
, bccRecipients : List String
|
||||||
|
, bccRecipientsModel : Comp.EmailInput.Model
|
||||||
, body : String
|
, body : String
|
||||||
, attachAll : Bool
|
, attachAll : Bool
|
||||||
, formError : Maybe String
|
, formError : Maybe String
|
||||||
@ -37,6 +41,8 @@ type alias Model =
|
|||||||
type Msg
|
type Msg
|
||||||
= SetSubject String
|
= SetSubject String
|
||||||
| RecipientMsg Comp.EmailInput.Msg
|
| RecipientMsg Comp.EmailInput.Msg
|
||||||
|
| CCRecipientMsg Comp.EmailInput.Msg
|
||||||
|
| BCCRecipientMsg Comp.EmailInput.Msg
|
||||||
| SetBody String
|
| SetBody String
|
||||||
| ConnMsg (Comp.Dropdown.Msg String)
|
| ConnMsg (Comp.Dropdown.Msg String)
|
||||||
| ConnResp (Result Http.Error EmailSettingsList)
|
| ConnResp (Result Http.Error EmailSettingsList)
|
||||||
@ -67,6 +73,10 @@ emptyModel =
|
|||||||
, subject = ""
|
, subject = ""
|
||||||
, recipients = []
|
, recipients = []
|
||||||
, recipientsModel = Comp.EmailInput.init
|
, recipientsModel = Comp.EmailInput.init
|
||||||
|
, ccRecipients = []
|
||||||
|
, ccRecipientsModel = Comp.EmailInput.init
|
||||||
|
, bccRecipients = []
|
||||||
|
, bccRecipientsModel = Comp.EmailInput.init
|
||||||
, body = ""
|
, body = ""
|
||||||
, attachAll = True
|
, attachAll = True
|
||||||
, formError = Nothing
|
, formError = Nothing
|
||||||
@ -83,6 +93,8 @@ clear model =
|
|||||||
{ model
|
{ model
|
||||||
| subject = ""
|
| subject = ""
|
||||||
, recipients = []
|
, recipients = []
|
||||||
|
, ccRecipients = []
|
||||||
|
, bccRecipients = []
|
||||||
, body = ""
|
, body = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,6 +115,26 @@ update flags msg model =
|
|||||||
, FormNone
|
, FormNone
|
||||||
)
|
)
|
||||||
|
|
||||||
|
CCRecipientMsg m ->
|
||||||
|
let
|
||||||
|
( em, ec, rec ) =
|
||||||
|
Comp.EmailInput.update flags model.ccRecipients m model.ccRecipientsModel
|
||||||
|
in
|
||||||
|
( { model | ccRecipients = rec, ccRecipientsModel = em }
|
||||||
|
, Cmd.map CCRecipientMsg ec
|
||||||
|
, FormNone
|
||||||
|
)
|
||||||
|
|
||||||
|
BCCRecipientMsg m ->
|
||||||
|
let
|
||||||
|
( em, ec, rec ) =
|
||||||
|
Comp.EmailInput.update flags model.bccRecipients m model.bccRecipientsModel
|
||||||
|
in
|
||||||
|
( { model | bccRecipients = rec, bccRecipientsModel = em }
|
||||||
|
, Cmd.map BCCRecipientMsg ec
|
||||||
|
, FormNone
|
||||||
|
)
|
||||||
|
|
||||||
SetBody str ->
|
SetBody str ->
|
||||||
( { model | body = str }, Cmd.none, FormNone )
|
( { model | body = str }, Cmd.none, FormNone )
|
||||||
|
|
||||||
@ -153,8 +185,18 @@ update flags msg model =
|
|||||||
case ( model.formError, Comp.Dropdown.getSelected model.connectionModel ) of
|
case ( model.formError, Comp.Dropdown.getSelected model.connectionModel ) of
|
||||||
( Nothing, conn :: [] ) ->
|
( Nothing, conn :: [] ) ->
|
||||||
let
|
let
|
||||||
|
emptyMail =
|
||||||
|
Api.Model.SimpleMail.empty
|
||||||
|
|
||||||
sm =
|
sm =
|
||||||
SimpleMail model.recipients model.subject model.body model.attachAll []
|
{ emptyMail
|
||||||
|
| recipients = model.recipients
|
||||||
|
, cc = model.ccRecipients
|
||||||
|
, bcc = model.bccRecipients
|
||||||
|
, subject = model.subject
|
||||||
|
, body = model.body
|
||||||
|
, addAllAttachments = model.attachAll
|
||||||
|
}
|
||||||
in
|
in
|
||||||
( model, Cmd.none, FormSend { conn = conn, mail = sm } )
|
( model, Cmd.none, FormSend { conn = conn, mail = sm } )
|
||||||
|
|
||||||
@ -195,6 +237,18 @@ view settings model =
|
|||||||
]
|
]
|
||||||
, Html.map RecipientMsg (Comp.EmailInput.view model.recipients model.recipientsModel)
|
, Html.map RecipientMsg (Comp.EmailInput.view model.recipients model.recipientsModel)
|
||||||
]
|
]
|
||||||
|
, div [ class "field" ]
|
||||||
|
[ label []
|
||||||
|
[ text "CC(s)"
|
||||||
|
]
|
||||||
|
, Html.map CCRecipientMsg (Comp.EmailInput.view model.ccRecipients model.ccRecipientsModel)
|
||||||
|
]
|
||||||
|
, div [ class "field" ]
|
||||||
|
[ label []
|
||||||
|
[ text "BCC(s)"
|
||||||
|
]
|
||||||
|
, Html.map BCCRecipientMsg (Comp.EmailInput.view model.bccRecipients model.bccRecipientsModel)
|
||||||
|
]
|
||||||
, div [ class "field" ]
|
, div [ class "field" ]
|
||||||
[ label [] [ text "Subject" ]
|
[ label [] [ text "Subject" ]
|
||||||
, input
|
, input
|
||||||
|
Loading…
x
Reference in New Issue
Block a user