SMTP SETUP GUIDE

Send Gitea and Forgejo email through SMTP with Ackuna

Gitea and Forgejo ship with mail switched off, so registration confirmations, password resets and notifications about issues and pull requests are never sent. Turn on the mailer, point it at the Ackuna relay, and they go out from your own domain.

Ackuna relay settings

Host
smtp.ackuna.com
Port
587
Security
STARTTLS (not SSL/TLS on connect)
Authentication
Yes, PLAIN or LOGIN
Username
YOUR_SMTP_USERNAME (starts with smtp_)
Password
YOUR_SMTP_PASSWORD (starts with sc_, shown once)
From address
any address on your verified domain, e.g. [email protected]

Before you start

You need three things from Ackuna. Each takes a few minutes, except the review in step 2.

  1. An Ackuna account. Create one for free; no card is needed.
  2. A verified sending domain. Add the domain your app sends from (for example yourdomain.com) under SMTP Relay, Domains in the console and publish the SPF, DKIM and DMARC records it shows you. The console checks them for you. A new sending domain is also reviewed by our team before it can send; that is not instant, and until it is approved the relay answers 452.
  3. An SMTP credential for that domain. Under SMTP Relay, Credentials, create one for the verified domain. You get a username (smtp_…) and a password (sc_…). The password is shown once, so paste it into Gitea and Forgejo straight away; if you lose it, rotate the credential.

The From address in Gitea and Forgejo must be on exactly that domain. A credential for yourdomain.com can send as [email protected], but not from a subdomain such as mail.yourdomain.com or from another domain.

Forgejo started as a fork of Gitea and keeps the same [mailer] section, so one configuration works for both.

The settings

Open your instance's app.ini and set the [mailer] section (the section layout is the one from Gitea 1.18 on):

[mailer]
ENABLED   = true
PROTOCOL  = smtp+starttls
SMTP_ADDR = smtp.ackuna.com
SMTP_PORT = 587
USER      = YOUR_SMTP_USERNAME
PASSWD    = `YOUR_SMTP_PASSWORD`
FROM      = "Your Git" <[email protected]>
  • PROTOCOL = smtp+starttls is what the Gitea and Forgejo docs give for port 587. They can infer it from the port, but writing it out avoids surprises.
  • Wrap the password in backticks, as the cheat sheet suggests for passwords with special characters.
  • FROM can be a bare address or the "Name" <address> form; either way it must be on your verified domain.
  • Leave FORCE_TRUST_SERVER_CERT at false: the relay has a publicly trusted certificate.

On Forgejo you can keep the password in a file instead, with PASSWD_URI = file:/etc/forgejo/mailer_passwd in place of PASSWD.

Gitea in Docker: environment variables

Gitea accepts app.ini values as environment variables of the form GITEA__<section>__<KEY>, and its official Docker images write them into app.ini on start-up. Forgejo has the same mechanism; check its Docker documentation for the variable prefix your image uses.

GITEA__mailer__ENABLED=true
GITEA__mailer__PROTOCOL=smtp+starttls
GITEA__mailer__SMTP_ADDR=smtp.ackuna.com
GITEA__mailer__SMTP_PORT=587
GITEA__mailer__USER=YOUR_SMTP_USERNAME
GITEA__mailer__PASSWD=YOUR_SMTP_PASSWORD
[email protected]

Restart Gitea or Forgejo after changing either.

Send a test email

Log in as an administrator and go to Site Administration, Configuration. In Gitea the test is under Summary, Mailer Configuration; in Forgejo under SMTP Mailer Configuration. Enter your address and send. The message appears under SMTP Relay, Messages in the Ackuna console.

Common errors

Authentication failed (535)

The username or password is wrong, the credential was revoked, or its domain is no longer active. Copy both values again from the console, with no spaces around them. If you no longer have the password, rotate the credential and paste the new one.

TLS handshake error, "wrong version number" or a connection that hangs

The app is trying SSL/TLS on connect, which the relay does not offer. Use port 587 with STARTTLS: the connection starts in plain text and is upgraded before the login. If the connection times out instead, check that your host or firewall allows outgoing connections to port 587; some cloud providers block it on new servers until you ask them to lift the block.

Sender rejected (550)

The From address is not on the domain the credential was created for. Set the From address in Gitea and Forgejo to an address on that exact domain. The same code is used for a recipient on your suppression list, because an earlier message to them bounced or was marked as spam.

Temporarily rejected (452)

Either you have reached your daily or monthly limit, or the sending domain is still waiting for review. Both are temporary: a mail server retries later, and the console shows your usage. A message with more than 10 recipients is also refused with 452, and one over 10 MB with 552.

Mail that is accepted but lands in spam usually points at DNS, not SMTP. Run the Email DNS check on your domain, or the SPF, DKIM and DMARC checkers one by one.

Limits

  • The Free plan includes 3,000 relay emails a month and 100 a day, 1 SMTP credential and 1 sending domain. Paid plans and their limits are on the pricing page.
  • New accounts start on lower limits until Ackuna has reviewed them: at most 20 Agent Mail, 200 SMTP relay and 500 newsletter emails a day, whatever the plan allows. After the review the plan limits above apply.
  • Each new sending domain is reviewed before it can send.
  • One message can have up to 10 recipients and be up to 10 MB.
  • While we deploy an update, port 587 stays open and the relay holds the mail it accepts, then sends it when the update is done. A login it cannot check during that time gets a temporary 451; a retry goes through once the update is done.
FAQ

Gitea and Forgejo SMTP questions

Should I use smtps instead?

No. smtps is TLS from the first byte, usually on port 465, which the relay does not offer. Use smtp+starttls on 587.

Why does PROTOCOL matter for the login?

The cheat sheet notes that authentication is only supported over an encrypted connection (or to localhost). With smtp+starttls the connection is encrypted before Gitea logs in, which is also what the relay requires.

Does USER have to be an email address?

No. The cheat sheet says it is usually the sender's address, but for the relay it is the credential username from the Ackuna console, which starts with smtp_.

Start sending in minutes

All three services free every month: 2,500 newsletter, 3,000 relay and 3,000 Agent Mail emails. No credit card required - upgrade only when your volume does.