Configuration
Here the definition of the MailgoConfig
object in TypeScript (available after version 0.9.0
)
#
MailgoConfig typethen initialize mailgo
following this definition
#
Mailgo config parameters#
mailtoTYPE: boolean
DEFAULT true
Enable or not mailto
links in mailgo
#
telTYPE: boolean
DEFAULT true
Enable or not tel
and callto
links in mailgo
#
sms // WIPTYPE: boolean
DEFAULT false
Enable or not sms
links in mailgo, by default it is disabled because it is WIP feature
#
desktopTYPE: boolean
DEFAULT true
Enable mailgo for desktop (uses user-agent)
#
mobileTYPE: boolean
DEFAULT true
Enable mailgo for mobile (uses user-agent)
#
actionsFor actions
parameter you can refer to this definition
DEFAULT all the values true
With this attribute you can enable/disable some actions in mailgo. By default all the values of actions
are true
(so enabled), but you can exclude some of them, for example with a config like
you are excluding Yahoo Mail and Skype. At the moment in mailgo you can exclude every actions except for copy
and default
, that are always enabled.
#
detailsYou can define which elements of the details (cc, bcc, subject...) appears in modal, obviously if they are defined in the link. By default all the details are shown, but you can decide it using this attribute.
cc
, bcc
, subject
and body
are the details for mailto, msg
the detail for tel/sms.
So for example you can pass this configuration
if you want to hide subject and body attributes in the modal.
The details
attribute works on the hiding/showing elements in the modal, not directly on parameters of the link. If you specify, for example, not to show the subject in the detail of the modal the subject will be not removed from the link, is simply doesn't appear in the modal.
#
darkTYPE boolean
DEFAULT false
If specified and equal to true
the mailgo dark mode is enabled for every mailgo modal in the website/page.
#
langTYPE: string
(DEFAULT en
)
The language of mailgo. Default is en
.
Possible values can be found in i18n.json
file in the repository, under translations
attribute.
The lang specified here is used only in website where is not specified lang
attribute in <html>
tag.
You can force the use of the lang
specified using the paramter forceLang
.
#
validateEmailTYPE boolean
DEFAULT true
To validate or not the email address(es), if the value is not valid the modal will not appear.
#
validateTelTYPE boolean
DEFAULT true
To validate or not the phone number, if the value is not valid the modal will not appear.
#
office365TYPE: boolean
DEFAULT false
Enable Office365 instead of classic outlook.live.com link in Outlook action
#
showFooterTYPE boolean
DEFAULT true
Show or not the footer in the modal with mailgo.dev link.
#
initEventTYPE: string
DEFAULT DOMContentLoaded
The event used to trigger mailgo. If you pass a value then a listener will be attached to the event.
#
Examplethen the code executed is this
In dist
version of mailgo the event is DOMContentLoaded
.
#
listenerOptionsTYPE: ListenerOptions
or boolean
DEFAULT false
The third parameter of the addEventListener
, complete reference: https://developer.mozilla.org/it/docs/Web/API/Element/addEventListener.
It is used only if an initEvent
is specified.
#
loadCSSTYPE boolean
DEFAULT true
Load mailgo CSS. true
recommended.
#
Mailgo configuration in windowThere is the possibility to define configuration for mailgo also adding it to the window
object. You can simply add (BEFORE adding mailgo.min.js
) a mailgoConfig
attribute to the window
that follows the MailgoConfig
type.
Here a simple example (in an html
file)
With this type of configuration the attribute initEvent
and listenerOptions
are not considered (because mailgo.min.js
fires by default ad DOMContentLoaded
with default ListenerOptions
).
For more examples about this configuration see index.windowconfig.html
in examples
folder in mailgo repository.