RunCloud.io is a server management software similar to CPanel. It’s easy to install and use on your server. By default, RunCloud.io does not install a email server, so you’re unable to send email from your applications. This includes being able to send emails from your WordPress site when users need to reset their passwords.
You should run these commands as a non-root user who has sudo privileges. If you have not setup a sudo user, follow the guide here.
Installing Postfix on your Ubuntu server
Run the command:
sudo apt-get update && sudo apt-get install postfix
You’ll be prompted to select your email type. Select “Internet Site” unless you know what you’re doing
- Select “Internet Site” unless you know what you’re doing
- Set your hostname for your email as the primary domain for your website (e.g. example.com)
- Set the root and postmaster mail recipient as the sudo user that you’re logged in as
- Select No on the “Force synchronous updates on mail queue” prompt
- Select the default when prompted for Local Networks
- Set the Mailbox Size Limit. Set the limit as “0” for no mailbox limit
- Select the default as when prompted for the “Local Address Extension Character”
- Select “all” when prompted for the Internet Protocols to use
Next, we need to adjust the PHP email settings for your selected PHP version. For PHP 7.1, update the php.ini setting by opening
in you’re preferred text editor.
Find the “sendmail_path” line in your php. ini. Update the settings to the following
; For Win32 only. ; http://php.net/sendmail-from ;sendmail_from = firstname.lastname@example.org ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). ; http://php.net/sendmail-path ;sendmail_path = ; Force the addition of the specified parameters to be passed as extra parameters ; to the sendmail binary. These parameters will always replace the value of ; the 5th parameter to mail(). ;mail.force_extra_parameters = ; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename mail.add_x_header = On
After updating your PHP settings, try sending an email using PHP. You can debug your email by tailing the mail log. Run the command
tail -f /var/log/mail.log
and you’ll see the result when sending an email.
Troubleshooting errors when sending emails through Vultr and Digital Ocean
Sometimes you’ll get errors when sending emails using Postfix. If you’re server host is Vultr or Digital Ocean, you’ll need to make sure that you’re server is allowed to send emails. These providers block the common email ports for new accounts in order to prevent spam from being sent from their servers. You’ll need to contact their support to unblock the common email ports.