Atlantiraptor Docs

mail

mail function

Type: Function

Send Email to a remote server.

This function will send an email to a remote SMTP server. The mail will be sent using SMTP with TLS and authentication.

Mails will be globally rate limited (among all queries) to the specified period (default 60 seconds) to prevent overloading the SMTP server. For this reason it is not suitable as a way to send high number of events - use it sparingly to notify on some rare events.

You can either fill in the auth_username and auth_password parameters directly or use the secrets service to encapsulate secrets in a managed way.

You can set any headers needed - for example to send HTML email set the Content-Type to “text/html”

Example

SELECT mail(secret="gmail",
            subject="Hello from Velociraptor",
            to="user@example.com",
            headers=dict(`Content-Type`="text/html"),
            body="<h1>Good morning</h1><p>From Velociraptor")
FROM scope()
Argument Type Description
to list of string (required) Recipient of the mail
from string The from email address.
cc list of string A cc for the mail
subject string The subject.
body string (required) The body of the mail.
period int64 How long to wait before sending the next mail - help to throttle mails.
server_port uint64 The SMTP server port to use (default 587).
server string The SMTP server to use (if not specified we try the config file).
auth_username string The SMTP username we authenticate to the server.
auth_password string The SMTP username password we use to authenticate to the server.
skip_verify bool Skip SSL verification(default: False).
root_ca string As a better alternative to disable_ssl_security, allows root ca certs to be added here.
secret string Alternatively use a secret from the secrets service. Secret must be of type ‘SMTP Creds’
headers ordereddict.Dict A dict of headers to send.

Required permissions: NETWORK

Platforms: macOS, Linux, Windows

Source: vql/networking/mail.go

mail plugin

Type: Plugin · Category: server

Send Email to a remote server.

See the mail() function for more details.

Argument Type Description
to list of string (required) Recipient of the mail
from string The from email address.
cc list of string A cc for the mail
subject string The subject.
body string (required) The body of the mail.
period int64 How long to wait before sending the next mail - help to throttle mails.
server_port uint64 The SMTP server port to use (default 587).
server string The SMTP server to use (if not specified we try the config file).
auth_username string The SMTP username we authenticate to the server.
auth_password string The SMTP username password we use to authenticate to the server.
skip_verify bool Skip SSL verification(default: False).
root_ca string As a better alternative to disable_ssl_security, allows root ca certs to be added here.
secret string Alternatively use a secret from the secrets service. Secret must be of type ‘SMTP Creds’
headers ordereddict.Dict A dict of headers to send.

Platforms: macOS, Linux, Windows