Email

From Traxel Wiki
Revision as of 02:31, 1 April 2024 by RobertBushman (talk | contribs)
Jump to navigation Jump to search

Links

GPT Recommendation

For a low-volume mail server setup on Debian 12 (Bookworm) that’s primarily used for sending outbound messages from a local instance of MediaWiki, you can opt for a simple yet reliable software stack. The primary goal here is to ensure that emails sent by MediaWiki (e.g., account creation confirmations, notifications) are delivered reliably without setting up a full-fledged mail receiving infrastructure.

Software Stack:

  • Postfix: A widely used, open-source Mail Transfer Agent (MTA) that can handle sending outbound emails. It’s relatively straightforward to configure for sending emails and can be secured to prevent unauthorized use.
  • Optional: Dovecot: If you ever decide to handle receiving emails (for bounces or administrative purposes), Dovecot is a secure IMAP and POP3 server that integrates well with Postfix. However, for your described use case, Dovecot may not be necessary.
  • Certbot (Let’s Encrypt): For securing your connections with TLS, using Certbot to obtain a free SSL certificate from Let’s Encrypt is recommended, especially if you’ll be sending sensitive information.

Basic Setup Instructions:

1. Install Postfix

  1. Update your package list:

    sudo apt update
  2. Install Postfix:

    sudo apt install postfix
  3. During installation, you’ll be prompted for some basic configuration:

    • General type of mail configuration: Choose “Internet Site”.
    • System mail name: This should be your domain name (e.g., example.com).

2. Basic Configuration

  1. Edit the main Postfix configuration file /etc/postfix/main.cf to ensure it’s set up for sending mail correctly. For a basic setup, you might only need to adjust or verify a few lines:

    inet_interfaces = loopback-only
    myhostname = example.com
    mydestination = 
    mynetworks = 127.0.0.0/8
    • inet_interfaces set to loopback-only ensures Postfix only listens on the localhost interface.
    • myhostname should be your server’s FQDN.
    • Clear mydestination to prevent Postfix from considering itself the final destination for mail.
    • mynetworks restricts which IPs can send mail through this server, set it to localhost only for security.
  2. Reload or restart Postfix to apply the changes:

    sudo systemctl restart postfix

3. Configure MediaWiki for Email

Ensure MediaWiki is configured to send email through your local Postfix installation. This is usually done in MediaWiki’s LocalSettings.php:

$wgSMTP = [
    'host' => 'localhost',
    'IDHost' => 'example.com',
    'port' => 25,
    'auth' => false,
];

Adjust example.com to match your domain.

Security and Sending Limits

  • IP and Domain Reputation: Ensure your server’s IP and domain have a good reputation. A new IP or one previously used for spam can negatively affect deliverability.
  • Reverse DNS: Set up reverse DNS for your server’s IP to match your domain. This is often done through your hosting provider’s control panel.
  • SPF Record: Add an SPF record to your domain’s DNS to authorize your server to send email on behalf of your domain.
  • DKIM and DMARC: For a low-volume server used as described, DKIM and DMARC are optional but recommended for improving email authenticity.

This setup is sufficient for sending outbound emails from a MediaWiki instance. Remember to monitor your server for any abuse and ensure that it’s not configured as an open relay. For more extensive email needs in the future, consider additional configurations and possibly using external SMTP services designed for high deliverability.