Skip to content

Instantly share code, notes, and snippets.

@ruslandoga
Last active April 8, 2026 15:19
Show Gist options
  • Select an option

  • Save ruslandoga/c94ce526231fb77930132aaeda3fc3c9 to your computer and use it in GitHub Desktop.

Select an option

Save ruslandoga/c94ce526231fb77930132aaeda3fc3c9 to your computer and use it in GitHub Desktop.

This short guides shows how to setup Plausible CE v2.1.0-rc.1 (or later) email delivery using your Gmail account.

Create App password

Go to your Google security settings and create an app password to be used in Plausible CE

Screenshot 2024-05-08 at 12 46 56 Screenshot 2024-05-08 at 12 24 08 Screenshot 2024-05-08 at 12 24 39 Screenshot 2024-05-08 at 12 24 46

Update configuration

Update your configuration to use the Bamboo.Mua mailer adapter. Your current SMTP_* settings will still work.

plausible-conf.env

  BASE_URL=https://plausible.example.com
  SECRET_KEY_BASE=PkVcxRgQDfQyhPETlog3vvCrj5LdYFSv4ejPEJHJO+i/37w6RZfRjeVCpJayjUjJMfXsNurcv5upPhTRoD3KgQ==
  TOTP_VAULT_KEY=aihU7k+GSBKbcVFuX9VEPyUhuwlKEomqA94/SQQ0NR4=
+ MAILER_ADAPTER=Bamboo.Mua
+ MAILER_EMAIL=your-username-here@gmail.com
+ SMTP_HOST_ADDR=smtp.gmail.com
+ SMTP_HOST_PORT=587
+ SMTP_USER_NAME=your-username-here@gmail.com
+ SMTP_USER_PWD="wnqj fkbn jcwc byxk"

Recreate container

Due to the immutable nature of containers, you need to recreate plausible to apply the new environment variables.

console

$ docker compose stop plausible
$ docker compose rm plausible
$ docker compose up -d

Verify

Now verify the updated configuration and try sending a test email.

console

$ docker compose exec plausible bin/plausible remote
iex> Application.get_env :plausible, Plausible.Mailer
#==> [
#==>   adapter: Bamboo.Mua,
#==>   auth: [username: "your-username-here@gmail.com", password: "wnqj fkbn jcwc byxk"],
#==>   relay: "smtp.gmail.com",
#==>   port: 587
#==> ]
iex> {:ok, _delivered_email} =
  Plausible.Mailer.deliver_now(
    Bamboo.Email.new_email(
      # pick one of your own mailboxes
      to: "your-username-here@gmail.com",
      from: PlausibleWeb.Email.mailer_email_from(),
      text_body: "test"
    )
  )

If it's delivered, you are all set! If not, leave the comment below and we'll try to help :)

@ruslandoga

ruslandoga commented May 8, 2024 •

Copy link
Copy Markdown
Author

Since this is a new SMTP client, all feedback is helpful! If it works well, please leave a thumbs up.

@raabmar

raabmar commented May 13, 2024

Copy link
Copy Markdown

@ruslandoga
I want to report back, that I just received the weekly emails sent by v2.1.0-rc.1 and this method/setup as described in this guide. The screenshot in the guide was not accurate, I didn't see the section for "App Passwords" (second screenshot) but I made it work by searching for it.

However, App Passwords is something that does not exist in Google Workspace. I think this is a kind of an outdated approach, not recommended anymore by Google and only available to personal Google accounts. Therefore the emails are sent now from my personal email and not my business Google Workspace mailbox, which I would like to change

I can also set up another SMTP mailbox like stats@mydomain.com and send from this one instead of Gmail. However, as this is all a bit above my understanding, I just followed the step by step guide successfully for the personal Google mailbox

I have a cheap Purelymail account for such things that won't cost me extra. Can I just use the data from Purelymail and send from it instead of Gmail. There I don't have to mess around with App Passwords, and I could still send from my own domain instead of a personal gmail mailbox

+ MAILER_ADAPTER=Bamboo.Mua
+ MAILER_EMAIL=stats@mydomain.com
+ SMTP_HOST_ADDR=smtp.purelymail.com
+ SMTP_HOST_PORT=587
+ SMTP_USER_NAME=stats@mydomain.com
+ SMTP_USER_PWD="mysmtppassword"

@ruslandoga

Copy link
Copy Markdown
Author

@raabmar 👋

Thank you for trying it out!

The screenshot in the guide was not accurate, I didn't see the section for "App Passwords" (second screenshot) but I made it work by searching for it.

Do you remember where it was located for you? I can update the guide with a note that it can be someplace else.

However, App Passwords is something that does not exist in Google Workspace.

This guide's goal is to provide the easiest setup for self-hosters using their personal accounts so supporting Google Workspaces or other professional Google products is outside of its scope.

Can I just use the data from Purelymail and send from it instead of Gmail.

It should work.

@raabmar

raabmar commented May 13, 2024

Copy link
Copy Markdown

@ruslandoga Now I can also see the section for "App Passwords" under Security → 2-Step Verification. I think it only shows up there, once you set an app password. But you can't actually add a new app password in here.

I only found it myself by using the search bar

image

After I added an App Password in there, then it also showed up here
image

OK, I'll see later if I can use the ordinary simple SMPT mailbox with my domain instead of Google Workspace.

@raabmar

raabmar commented May 13, 2024

Copy link
Copy Markdown

I confirm, I just tested it with Purelymail - a simple SMTP mailbox for an affordable price and it works, so I can send the emails from e.g. analytics@mydomain.com

(my main domain is mydomain.at but this one is already setup for Google Workspace, so I have another domain (.com) for some other use cases like this one)

@raabmar

raabmar commented May 13, 2024

Copy link
Copy Markdown

Note: I just tested by inviting myself with some private address as a member to a site. Seems to be an easy way to test email.

@Striffly

Copy link
Copy Markdown

Hi

I can't get this new mail client to work: no email is sent when using invitation or password reset.

This is my configuration :

MAILER_ADAPTER=Bamboo.Mua
MAILER_EMAIL=noreply@xxxx.fr
SMTP_HOST_ADDR=ssl0.ovh.net
SMTP_HOST_PORT=587
SMTP_USER_NAME=noreply@xxxx.fr
SMTP_USER_PWD=xxxxxxxxx

However, I receive emails with this command :

{:ok, _delivered_email} =
  Plausible.Mailer.deliver_now(
    Bamboo.Email.new_email(
      # pick one of your own mailboxes
      to: "xxxx@hotmail.fr",
      from: PlausibleWeb.Email.mailer_email_from(),
      subject: "how are you?",
      text_body: "I'm fine",
      html_body: "I'm <i>fine</i>"
    )
  )

@ruslandoga

ruslandoga commented May 28, 2024 •

Copy link
Copy Markdown
Author

Replied in plausible/analytics#4125 (reply in thread) (since it's not exactly related to Mua+GMail setup)

@degoya

degoya commented Nov 21, 2024

Copy link
Copy Markdown

you should notice that the option for adding an App Password are only visible when your account got 2FA enabled.
Further Details you can find here: https://support.google.com/mail/answer/185833?hl=en , there you can also find links for setting 2FA and creating the App Password when logged in.
took me a while to sort it out, hope this helps someone setting it up more easy.

@OndrejValenta

Copy link
Copy Markdown

Works for Office 365 as well..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment