]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Database/Action/Mail.hs
[OPTIM]
[gargantext.git] / src / Gargantext / Database / Action / Mail.hs
1 {-|
2 Module : Gargantext.Database.Action.Mail
3 Description :
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
8 Portability : POSIX
9
10
11 -}
12
13 module Gargantext.Database.Action.Mail
14 where
15
16 import Control.Lens (view)
17 import Gargantext.Prelude
18 import Gargantext.Database.Prelude
19 import Gargantext.Database.Query.Table.Node.Error (HasNodeError(..))
20 import Gargantext.Core.Mail
21 import Gargantext.Prelude.Config
22 import Gargantext.Database.Schema.User
23 import Gargantext.Database.Action.User
24 import Gargantext.Core.Types.Individu (User(..))
25
26 ------------------------------------------------------------------------
27
28 sendMail :: HasNodeError err => User -> Cmd err ()
29 sendMail u = do
30 server <- view $ hasConfig . gc_url
31 userLight <- getUserLightDB u
32 liftBase $ mail server (MailInfo (userLight_username userLight) (userLight_email userLight))
33