Post Installation Steps

(You may need to disable your firewall if you have not already allowed the required ports Disable Firewall)

1. Creating a user

  • To create users, select Accounts/Lookup from the admin interface (https://yourserver:7025)
  • Enter a username and password and click on Create.

2. Test locally

  • Use the builting surgeweb to send/receive local emails  https://your.server/surgeweb
  • Use any IMAP/POP email client/app to send/receive local messages.

3. Incoming mail

  • You will need to add your MX dns entries correctly to receive email.
    • MX 10 your.domain.name --> mail.your.domain.name
    • A mail.your.domain.name --> 1.1.1.1 (your ip address)
  • Turn off any firewall or enable ports 25,110,143,80,443 at least.

4. Outgoing mail

  • It should work immediately, if it doesn't check the logs for the reason, your ISP may be blocking port 25, in which case you can send via their system using a g_gateway rule, or move your server to an unrestricted place (we recommend a hosting provider like Linode.com)

5. Basic tests you can do

tellmail test_port25

tellmail test_spf_dkim

tellmail test_dns netwinsite.com

tellmail pingall

tellmail friends_url

6. How to disable firewalls on linux

See firewall page

7. Message Delivery

To maintain a good reputation for your domain you should probably register with one or two of the major email servervices that can send you reports on spam coming from your server, this may occur if you get one of your accounts hacked, or a valid local user is miss behaving, or some of your legitimate messages may simply annoy people, and you need to know when and how often this occurs to maintain a good reputation which will lead to good delivery rates.

Google has 'Postmaster Tools' Get started with Postmaster Tools https://support.google.com/mail/answer/9981691

And Microsoft/Outlook has junk email reporting options: https://sendersupport.olc.protection.outlook.com/pm/services.aspx

Systemd Startup scripts

By default surgemail should create systemd startups on systems that use systemd, however if it hasn't you can remove the init.d startups and manually.

Remove unused Sys-V-init-Script

rm /etc/rc.d/init.d/surgemail

Create a systemd startup, copy this code to '/etc/systemd/system/surgemail.service'

[Unit]
Description=SurgeMail Email
Conflicts=sendmail.service exim.service postfix.service dovecot.service

[Service]
Type=forking
PIDFile=/usr/local/surgemail/surgemail.pid
ExecStart=/usr/local/surgemail/surgemail_start.sh
ExecStop=/usr/local/surgemail/surgemail_stop.sh

[Install]
WantedBy=multi-user.target

Then issue the command:

systemctl enable surgemail

systemctl start surgemail

Problems with SELinux

If SELinux is enabled (what is recommended!) it may disallow start of SurgeMail by systemd. If SurgeMail will not start, check the systemd status output. If it looks like that, SELinux may be the problem:

Double check SELinux log:

[root@mailx04 ~]# grep surgemail_start.sh /var/log/audit/audit.log type=AVC msg=audit(1692197745.617:4710): avc: denied { execute } for pid=7290 comm="(start.sh)" name="surgemail_start.sh" dev="dm-2" ino=894 scontext=system_u:system_r:init_t:s0 tcontext=unconfined_u:object_r:unlabeled_t:s0 tclass=file permissive=0

If such a “denied”-entry exists, SELinux is the cause. Create the folllowing SELinux rules:

semanage fcontext -a -t bin_t /usr/local/surgemail
chcon -Rv -u system_u -t bin_t /usr/local/surgemail
restorecon -R -v /usr/local/surgemail

Was this article helpful?

Related Articles