From Wikitech
Jump to navigation Jump to search


This page covers using sending email to users, tools, and from the grid.

Please note that Toolforge emails servers enforce ratelimits per email address.

Mail to users

Mail sent to (where user is a shell account) will be forwarded to the email address that user has set in their Wikitech preferences if it has been verified (the same as the 'Email this user' function on wikitech).

Any existing .forward in the user's home will be ignored.

Mail to a Tool

Mail can also be sent "to a tool" with:

Where "anything" is an arbitrary alphanumeric string. Mail will be forwarded to the first of:

  • The email addresses listed in the tool's $HOME/.forward.anything, if present;
  • The email addresses listed in the tool's $HOME/.forward, if present; or
  • The email addresses of the tool's maintainers.

Additionally, is an alias pointing to mostly useful for automated email generating from within Cloud VPS.

$HOME/.forward and $HOME/.forward.anything need to be readable by the user Debian-exim; to achieve that, you probably need to explicitly make the file world readable with a shell command like chmod o+r $HOME/.forward*.

All of these addresses can also be used via the legacy domain

Prior to early 2019 it was also possible to use a .forward file to configure automatic processing of in-bound email messages by a grid job. This feature was removed as it was not used by many tools and complicated the maintenance of Toolforge. Similar functionality can be achieved by routing inbound emails to an account on an external mail host with IMAP or POP support and polling for new messages from a cron job or long running process.

Mail from Tools

Sending via SMTP

The SMTP protocol can be used to send outbound emails from a tool running on either Kubernetes or the job grid. The service name is used as the public mail exchange (MX) host for inbound SMTP messages to the domain and points to a server that can process both inbound and outbound email for Toolforge.

Containers running on the Toolforge Kubernetes cluster do not install and configure a local mailer service like the exim service that is installed on grid engine nodes. Tools running in Kubernetes should instead send email using an external SMTP server. The service name should be used as the target SMTP server.

Sending via the command line

The job grid hosts in Toolforge install and configure a local mailer service (currently Exim) which can be used to send outgoing email messages. This feature is not available inside Kubernetes containers.

When sending mail from a grid job, the common command line method of piping the message body to /usr/bin/mail may not work correctly because /usr/bin/mail attempts to deliver the message to the local mail submission agent (MSA) in a background process which will be killed if it is still running when the controlling grid job exits.

If piping to a subprocess to send mail is needed, the message including headers may be piped to /usr/sbin/exim -odf -i.

# This does not work when submitted as a job
echo "Test message" | /usr/bin/mail -s "Test message subject"

# This does
echo -e "Subject: Test message subject\n\nTest message" | /usr/sbin/exim -odf -i
  • Note: /usr/bin/echo supports -e in case your shell's internal echo command doesn't.

See also

Communication and support

We communicate and provide support through several primary channels. Please reach out with questions and to join the conversation.

Communicate with us
Way Connect Best for
Phabricator Workboard #Cloud-Services Task tracking and bug reporting
IRC Channel #wikimedia-cloud connect
Telegram bridge
mattermost bridge
General discussion and support
Mailing List cloud@ Information about ongoing initiatives, general discussion and support
Announcement emails cloud-announce@ Information about critical changes (all messages mirrored to cloud@)
News wiki page News Information about major near-term plans
Cloud Services Blog Clouds & Unicorns Learning more details about some of our work
Wikimedia Technical Blog News and stories from the Wikimedia technical movement