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.
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
# 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:email@example.com" "P:your_email_password"
Make a hash file,
# sudo makemap hash smtp-auth < smtp-auth
# 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
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 firstname.lastname@example.org
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.
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
- Toggle, Mailer: enabled
- Adapter (dropdown), SMTP
- Relay, mail.host.yours.net (as above)
- Port, 465 (or as above)
- Username, email@example.com (as above)
- Password, youremailpassword (as above)
- Use SSL, (enable if port 465)
I hope it works for you. Happy days!
- Cloudbooklet, 9 Aug 2021 Install Sendmail, Debian 10
- Diaspora Foundation Diaspora Wiki, Debian 10
- Suguru Hirahara, 28 Jan 2021 Progressive.blog.dev Install Diaspora, Debian 10