Skip to content

Install and configure a simple mail server for sending mails using PHP mail function in Faveo on Centos 7 server

Arjunladybird edited this page May 9, 2018 · 3 revisions

Introduction

This document will list steps on how to install a simple mail server for Faveo.

Firewall Access You will need to set your firewall(s) to allow access to the following ports:

  • SMTP: 25
  • POP3: 110
  • IMAP: 143
  • SMTP Secure: 465

By default, the Cloud Panel Firewall denies access to all but the most commonly-used ports. For instructions on how to allow port access, consult our article "Creating a Cloud Panel Firewall".

We need following dependencies in order to make mail server work:

  • PHP 7.1
  • PHP Extensions: listed in server requirement
  • Composer
  • Telnet

Install Composer

If you have already installed composer skip this Step

curl -sS https://getcomposer.org/installer | php

mv composer.phar /usr/bin/composer

chmod +x /usr/bin/composer

Install PHP-Mailer

composer require phpmailer/phpmailer

Install postfix

yum install -y postfix

Configuring Postfix

Main configuration file for Postfix is ‘/etc/postfix/main.cf’.

Open the file to make changes to it

vi /etc/postfix/main.cf
myhostname = example.com                                                                 # Line 77
mydomain = example.com                                                                   # Line 85
myorigin = $mydomain                                             	                 # Line 101
inet_interfaces = all                                                   	         # Line 115
inet_protocols = all                                                                     # Line 121
#mydestination = $myhostname, localhost.$mydomain, localhost,                            # Line 166        (comment_it)
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain 	# Line 167        (uncomment)
mynetworks = 192.168.1.0/24, 127.0.0.0/8        	                                 # Line 266
home_mailbox = Maildir/                                        	                         # Line 421

Make sure you make changes as per your domain. Save the file & exit and restart the postfix service to implement the changes

systemctl restart postfix

Enable the service

systemctl enable  postfix

Testing Postfix

yum install -y telnet
telnet localhost 25
You will see a screen with following,
Trying ::1…
Connected to localhost.
Escape character is ‘^]’.
220 example.com ESMTP Postfix

To send a mail

mail from:<mailid>
 
Then enter recipient mail address

rcpt to:<mailid>

Enter the mail you want to type

data	                                                                 # will put text in mail body

354 End data with <CR><LF>.<CR><LF>
This is a test mail .

After you mail body is complete, type . (dot)

.

To exit from the session, type

quit

Installation and Upgrade Guide

Administrator's Guide

Agent's Guide

Email Integration

Release & Upgrade Notes

Known Issues

Contribute & Feedback

Knowledge Base

Third Party Integration

Plugins

API

Clone this wiki locally