Skip to content

Instantly share code, notes, and snippets.

@TehPeGaSuS
Last active September 20, 2025 20:32
Show Gist options
  • Select an option

  • Save TehPeGaSuS/62b608da29fa76c993a412fc5894ff3a to your computer and use it in GitHub Desktop.

Select an option

Save TehPeGaSuS/62b608da29fa76c993a412fc5894ff3a to your computer and use it in GitHub Desktop.
Anope + MSMTP + Gmail

You've set up your IRC server and you have Anope running smoothly, but now you want email confirmation?

Here's a small tutorial on how to do it, using Gmail as email relay, which you can reuse to make it work with your own email server.

NOTE: For the purpose of this tutorial I'm assuming you're using Ubuntu/Debian, nano editor and that there's no SMTP server running on your machine.


Enable app password for your Gmail account

Follow this YouTube tutorial to enable an app password for your account and save the password on a safe location because you're going to see it only once.

NOTE: Save the app password without spaces between each set of characters (it'll be displayed with spaces for easiness of reading)

Install MSMTP

On your server, as root, type: apt install msmtp-mta msmtp

If it asks if you want to enable apparmor support, chose <Yes>

Create your .msmtprc file

  1. Now, go back to your Anope user, type nano ~/.msmtprc and put the below inside your file, editing it to fit your needs:
### Default values for all following accounts. ###
defaults
auth              on
tls               on
tls_certcheck     on
tls_trust_file    /etc/ssl/certs/ca-certificates.crt
logfile           ~/.msmtp.log
logfile_time_format "%d %b %Y - %H:%M:%S"

### Anope account ###
account services

# SMTP server host
host smtp.gmail.com

# SMTP server port
port 587

### Encryption method ###
# For port 587 set to "on"
tls_starttls on

### EDIT ONLY HERE ###
# SMTP user (used to log in)
user "[email protected]"

# SMTP From (must match your account for Gmail)
from "[email protected]"

# SMTP user password
password "password_from_video_tutorial"
### STOP EDITING HERE ###

### Default account to use when none is specified ###
account default: services
  1. Hit CTRL+X, followed by Y and then Enter to save your .msmtprc file.
  2. Set the correct file permissions with chmod 600 ~/.msmtprc

Edit your Anope config

  1. For Anope 2.0, edit services.conf and do the following:
  • Replace sendmailpath = "/usr/sbin/sendmail -t" with sendmailpath = "/usr/bin/msmtp -a services -t"
  • Replace sendfrom = "[email protected]" with sendfrom = "Network Services <[email protected]>"
  1. For Anope 2.1, edit anope.conf and do the following:
  • Replace sendmailpath = "/usr/sbin/sendmail -t" with sendmailpath = "/usr/bin/msmtp -a services -t"
  • Replace sendfrom = "[email protected]" with sendfrom = "Network Services <[email protected]>"

Test your MSMTP configuration

To test your MSMTP configuration, type the following command on your terminal:

echo "MSMTP test for Anope." | msmtp -a services [email protected]

Finish

If you received the email sent with the above comment, then it means you have it all working.

Now, just reload or restart Anope and you have successfully enabled email confirmation on Anope.

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