Do you have a mail server setup in your system?
If you already have a mail server, then kindly let me know.
If you do not have a mail server, you can install various mail servers like Postfix, Exim4 (more complicated, but more options for customization), etc.
My assumption is that you do not have a mail server.
To install postfix:
- Ubuntu/Debian:
sudo apt-get install postfix
- CentOS/Fedora: First:
sudo yum install epel-release
, and sudo yum install postfix
or sudo dnf install postfix
- Arch Linux:
sudo pacman -S postfix
DO NOT USE BOTH OF THEM TOGETHER, ELSE YOU WILL GET INTO MORE PROBLEMS!
To install exim4:
- Ubuntu/Debian:
sudo apt-get install exim4
- CentOS/Fedora: First:
sudo yum install epel-release
, and sudo yum install exim
or sudo dnf install exim
- Arch Linux:
sudo pacman -S exim
Side note:
You can use PHPMailer instead of the mail()
function.
You have many features in PHPMailer like using DKIM, sending with attachments, and better error debugging.