Configuring SMTP in Anope IRC Services (2.0+) allows NickServ to send registration confirmation emails and MemoServ to send offline memos. Anope generally relies on a local mail transfer agent (like Postfix, Exim, or Sendmail) to handle the actual sending.
Prerequisites
- Mail Transfer Agent (MTA): Ensure
sendmailorpostfixis installed and running on your server. - SMTP Service: If not using a local MTA, you will need access to a remote SMTP server.
Configuration Steps
- Locate Configuration File: Open your
services.conffile, typically located in~/services/conf/ordata/. - Configure Mail Block: Locate or create the
mailconfiguration block.confmail { usemail = yes sendmailpath = "/usr/sbin/sendmail -t" sendfrom = "anope@sisrv.net" # Optional: restrict = yes # Optional: delay = 5m }usemail: Set toyesto enable email features.sendmailpath: Set this to the absolute path of your sendmail binary (e.g.,/usr/sbin/sendmail -tor/usr/sbin/postfix).sendfrom: The email address that registration emails will appear to come from.
- Enable Registration Emails (Optional): To require users to verify their email address during nickname registration, add the following to
services.conf:confemailregistration = yes - Rehash Services: Restart Anope or issue the
OPERSERV REHASHcommand to apply the changes.
Troubleshooting
- Emails not sending: Ensure your MTA (e.g., Postfix) is authorized to send mail and is not being blocked by a firewall or your hosting provider.
- Commands: Use
NS REGISTERto test registration ifemailregistrationis enabled. - Alternative: If you do not have a local MTA, some advanced users configure SMTP modules to send via external mail servers, but using local sendmail is standard.
Anope IRC Services does not possess a built-in direct SMTP client. Instead, it relies on your local system's sendmail binary to route emails out through an SMTP server.
To get this working, you must configure a local Mail Transfer Agent (MTA) like Postfix or msmtp on your server to handle external SMTP delivery, and then point Anope to that executable.
To get this working, you must configure a local Mail Transfer Agent (MTA) like Postfix or msmtp on your server to handle external SMTP delivery, and then point Anope to that executable.
Step 1: Set up the Local SMTP Forwarder
If you do not have a full mail server installed, it is easiest to install
msmtp or Postfix and configure them to relay your emails to an external SMTP server (like Gmail, SendGrid, or your own mail server). Option A: Using msmtp (Lightweight)
- Install
msmtpon your system. - Edit your local msmtp configuration (usually at
/etc/msmtprcor~/.msmtprc) and add your external SMTP server credentials:textaccount default host ://yourprovider.com port 587 from services@yournetwork.net auth on user yourusername password yourpassword tls on tls_trust_file /etc/ssl/certs/ca-certificates.crtUse code with caution.
Option B: Using Postfix (Standard)
- Install
postfixand select "Satellite system" during the setup prompts. - Configure it to use your external SMTP provider as a "relayhost".
Step 2: Configure Anope's Mail Block
Once your system can successfully send mail from the command line, update your Anope configuration.
- Open your main Anope configuration file (usually
services.conformail.conf). - Locate or create the
mail {}block and update it to point to your functional sendmail path:
mail
{
/* Enable the use of mail */
usemail = yes
/* Path to the sendmail binary on your system.
* If using msmtp, point this directly to the msmtp binary or the msmtp sendmail symlink.
*/
sendmailpath = "/usr/sbin/sendmail -t"
/* The email address messages will appear to come from */
sendfrom = "services@sisrv.net"
/* Limits mail sending to authorized operators if set to 'yes' */
restrict = no
/* Time to wait between sending emails */
delay = 5m
}
Use code with caution.
Step 3: Enable E-mail Registration in NickServ
To force users to use and verify their email addresses upon registering, you need to enable it in your
nickserv.conf. - Open your
nickserv.conffile. - Ensure the following configurations are set:
module { name = "ns_register" }
module { name = "ns_confirm" }
nickserv
{
/* Forces users to provide an email during registration */
forceemail = yes
/* Requires users to click a link or enter a code sent to their email */
emailregistration = yes
}
Use code with caution.
- Restart or rehash your Anope services to apply the changes.
Would you like help with testing the sendmail path from your Linux terminal to make sure it functions properly?
