Sendmail for Diaspora or Pleroma (Ubuntu & Debian)

Relevance Users of your instance need a login password-reset link or other notifications, sent to their private email address.

Considerations Sendmail, being one of the oldest, behaves well alongside other mail delivery setups. The configuration and files you are going to edit, are compatible with Postfix, for example.

Best practice is to do the following on a fresh setup, i.e. after installing or upgrading your OS, and before commencing installation of the actual website or instance.

IMPORTANT: Remember to do a back-up before making any changes to your precious server. This procedure may not work should your vps service have the smtp ports locked or when the receiving email client always rejects mail from your server.

Required Obtain from your email service, the SMTP host information and port information (587 or something else)

My domain registration provides this host: mail.gandi.net, for instance.

Installation

  1. Update, Install, Insert hostname $ = terminal, as user. #, terminal as root. Terminal commands – copy everything after the # or $ in this guide.

    $ su - root
    # apt update
    # apt install sendmail -y
    # hostname
    # hostname --fqdn
    

    [Remember this information, you may have to insert into [hostname] in the 'hosts' file]

    # nano /etc/hosts
    

    127.0.0.1 localhost [hostname] [hostname -fqdn] 127.0.1.1 localhost [hostname] [hostname -fqdn] [edit if necessary, [hostname] (no square brackets), CTRL+x, Y, Enter

  2. E-mail Authentication

    # mkdir /etc/mail/authinfo
    # chmod -R 700 /etc/mail/authinfo
    # cd /etc/mail/authinfo
    # nano smtp-auth
    

    Add this to the file. Your actual full email (login), and password:

    AuthInfo: "U:root" "I:your@email.com" "P:your_email_password"
    

    Make a hash file,

    # sudo makemap hash smtp-auth < smtp-auth
    
  3. Configuration

    # cd /etc/mail
    

    Edit the text-block below, reflecting your own information. Important: change mail.host.yours.net to your own email host Leave port 587 as it is, unless your email service port is different. Then paste the edited text into the sendmail.me file, which you will edit (nano) now.

    # nano sendmail.mc
    

    Find this line “MAILER_DEFINITIONS” and paste the edited text-block immediately after that

    define(`SMART_HOST',`mail.host.yours.net')dnl
    define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
    define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl
    define(`confAUTH_OPTIONS', `A p')dnl
    TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
    define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
    FEATURE(`authinfo',`hash -o /etc/mail/authinfo/smtp-auth.db')dnl
    
  4. Make, reload, restart

    # cd /etc/mail
    # make
    # /etc/init.d/sendmail reload
    # /etc/init.d/sendmail restart
    

    Test to see it works. Do this (you may need to run it a few times). Check your email to see if it is delivered. It may appear in your server email. Open THAT (nano) to see what errors show up. The command to run a test is:

    echo "My test email being sent from sendmail" | /usr/sbin/sendmail youname@yourmail.com
    

    Troubleshoot: check every step in this guide. Nano into every file to check your edits. Is the password, host, port and email, correct? Finally, do

    # sendmailconfig
    # /etc/init.d/sendmail restart
    

    Your Diaspora* instance should now send out an email for notifications. You can test it by logging out and checking the 'forgot password' link.

  5. Pleroma Moderator Panel (AdminFE) Of course, this only applies to a Pleroma instance. Get into this panel (soapbox, from Admin user's profile). “Moderator, or “AdminFE”. On the left of the AdminFE, locate these sections, and make these adjustments.

Settings, Mailer section. Pleroma.Emails.Mailer section

I hope it works for you. Happy days!

Sources

  1. Cloudbooklet, 9 Aug 2021 Install Sendmail, Debian 10
  2. Diaspora Foundation Diaspora Wiki, Debian 10
  3. Suguru Hirahara, 28 Jan 2021 Progressive.blog.dev Install Diaspora, Debian 10

#fediverse #linux #socialmedia