Files
herolib/lib/clients/mailclient
2025-10-29 09:36:37 +04:00
..
2024-12-25 09:23:31 +01:00
...
2025-10-29 09:36:37 +04:00

mailclient

To get started


import incubaid.herolib.clients.mailclient


//remove the previous one, otherwise the env variables are not read
mailclient.config_delete(name:"test")!

// env variables which need to be set are:
// - MAIL_FROM=...
// - MAIL_PASSWORD=...
// - MAIL_PORT=465
// - MAIL_SERVER=...
// - MAIL_USERNAME=...


mut client:= mailclient.get(name:"test")!

println(client)

client.send(subject:'this is a test',to:'kristof@incubaid.com',body:'
    this is my email content
    ')!

example heroscript

!!mailclient.configure
    secret: '...'
    host: 'localhost'
    port: 8888

use of env variables

if you have a secrets file you could import as

//e.g.  source ~/code/git.threefold.info/despiegk/hero_secrets/mysecrets.sh

following env variables are supported

  • MAIL_FROM=
  • MAIL_PASSWORD=
  • MAIL_PORT=465
  • MAIL_SERVER=smtp-relay.brevo.com
  • MAIL_USERNAME=kristof@incubaid.com

these variables will only be set at configure time

brevo remark

  • use ssl
  • use port: 465