Configuring SMTP in Anope IRC Services

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 sendmail or postfix is 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
  1. Locate Configuration File: Open your services.conf file, typically located in ~/services/conf/ or data/.
  2. Configure Mail Block: Locate or create the mail configuration block.
    conf
     
    mail {
        usemail = yes
        sendmailpath = "/usr/sbin/sendmail -t"
        sendfrom = "anope@sisrv.net"
        # Optional: restrict = yes
        # Optional: delay = 5m
    }
    
    • usemail: Set to yes to enable email features.
    • sendmailpath: Set this to the absolute path of your sendmail binary (e.g., /usr/sbin/sendmail -t or /usr/sbin/postfix).
    • sendfrom: The email address that registration emails will appear to come from.
  3. Enable Registration Emails (Optional): To require users to verify their email address during nickname registration, add the following to services.conf:
    conf
     
    emailregistration = yes
    
  4. Rehash Services: Restart Anope or issue the OPERSERV REHASH command 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 REGISTER to test registration if emailregistration is 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) 
  1. Install msmtp on your system.
  2. Edit your local msmtp configuration (usually at /etc/msmtprc or ~/.msmtprc) and add your external SMTP server credentials:
    text
    account 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.crt
    
    Use code with caution.
 
Option B: Using Postfix (Standard)
  1. Install postfix and select "Satellite system" during the setup prompts.
  2. 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.
  1. Open your main Anope configuration file (usually services.conf or mail.conf).
  2. 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. 
  1. Open your nickserv.conf file.
  2. 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.
 
  1. 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?
  • Anope IRC Services SMTP, Configuring SMTP, sendmail
  • 38 Usuários acharam útil
Esta resposta lhe foi útil?

Artigos Relacionados

How to install Anope Services

Anope is a set of IRC Services designed for flexibility and ease of use. Anope is available in...

How to upgrade Anope 2.x

Anope is an open source set of IRC Services. It is highly modular, with a vast number of...

How to install Anope 2 Modules

Anope Modules are a quick and easy way to add or change the functionality of the main Anope...

Nickname Registration

Nickname RegistrationYour nick is how people on SiSrv know you. If you register it, you'll be...

ChanServ Commands

NOTE: Some IRC servers provide an alias for '/msg ChanServ' where you can use '/cs' or...

Powered by WHMCompleteSolution