Creating a mail server on Linux powered machines can be one of the most essential things that every system administrator needs to do while configuring the servers for the first time, if you don’t know what it means; it’s simple, if you have a website like “example.com”, you can create an email account like “[email protected]” to use it to send/receive emails easily instead of using services like Hotmail, Gmail, Yahoo Mail, etc.
In this article, we’ll learn how to do so by installing the Postfix mail server with the “Roundcube” webmail application and its dependencies on Debian 10/9 and Ubuntu 20.04/18.04/16.04 LTS releases.
On this page
- Set a Hostname and Create DNS Records for Mail Domain
- Installing Apache, MariaDB, and PHP on Ubuntu
- Installing Postfix Mail Server on Ubuntu
- Testing Postfix Mail Server on Ubuntu
- Installing Dovecot IMAP and POP in Ubuntu
- Installing Roundcube Webmail in Ubuntu
- Create an Apache Virtual Host for Roundcube Webmail
- Creating Mail Users to Access Mails via Roundcube
Step 1: Set a Hostname and Create DNS Records for Domain
1. First, set a valid FQDN (Fully Qualified Domain Name) hostname for your Ubuntu server using the hostnamectl command as shown.
$ sudo hostnamectl set-hostname mail.tecmint.com
2. Next, you need to add a MX
and A
records for your domain in your DNS control panel that guides other MTAs that your mail server mail.yourdomain.com
domain is responsible for email delivery.
MX record @ mail.tecmint.com mail.tecmint.com <IP-address>
Step 2: Installing Apache, MariaDB, and PHP on Ubuntu
3. In order to create a running mail server using “Roundcube”, we’ll have to install Apache2, MariaDB, and PHP packages first, to do so, run.
$ sudo apt-get update -y $ sudo apt-get upgrade -y $ sudo apt install apache2 apache2-utils mariadb-server mariadb-client php7.4 libapache2-mod-php7.4 php7.4-mysql php-net-ldap2 php-net-ldap3 php-imagick php7.4-common php7.4-gd php7.4-imap php7.4-json php7.4-curl php7.4-zip php7.4-xml php7.4-mbstring php7.4-bz2 php7.4-intl php7.4-gmp php-net-smtp php-mail-mime php-net-idna2 mailutils
On Debian 10/9, you need to download and install the SURY PHP PPA repository to install PHP 7.4 on Debian 10/9 as shown.
$ sudo apt -y install lsb-release apt-transport-https ca-certificates $ sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg $ echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list $ sudo apt update $ sudo apt install apache2 apache2-utils mariadb-server mariadb-client php7.4 libapache2-mod-php7.4 php7.4-mysql php-net-ldap2 php-net-ldap3 php-imagick php7.4-common php7.4-gd php7.4-imap php7.4-json php7.4-curl php7.4-zip php7.4-xml php7.4-mbstring php7.4-bz2 php7.4-intl php7.4-gmp php-net-smtp php-mail-mime php-net-idna2 mailutils
Step 3: Installing Postfix Mail Server on Ubuntu
4. Postfix is a mail transfer agent (MTA) which is the responsible software for delivering & receiving emails, it’s essential in order to create a complete mail server.
To install it on Ubuntu/Debian or even Mint, run:
$ sudo apt-get install postfix
During installation, you will be asked to choose the type of mail configuration, choose “Internet Site”.

5. Now enter the fully qualified domain name that you want to use for send and receive emails.

6. Once Postfix installed, it will automatically start and creates a new /etc/postfix/main.cf file. You can verify the Postfix version and status of the service using the following commands.
$ postconf mail_version $ sudo systemctl status postfix

Step 4: Testing Postfix Mail Server on Ubuntu
7. Now try to check your mail server is connecting on port 25 using the following command.
$ telnet gmail-smtp-in.l.google.com 25 Trying 74.125.200.27... Connected to gmail-smtp-in.l.google.com. Escape character is '^]'. 220 mx.google.com ESMTP k12si849250plk.430 - gsmtp
The above message indicates that the connection is successfully established. Type quit to close the connection.
8. You can also use a mail program to send and read emails using the following command.
$ mail [email protected] Cc: Subject: Testing My Postfix Mail Server I'm sending this email using the postfix mail server from Ubuntu machine
Step 5: Installing Dovecot IMAP and POP in Ubuntu
9. Dovecot is a mail delivery agent (MDA), it delivers the emails from/to the mail server, to install it, run the following command.
$ sudo apt-get install dovecot-imapd dovecot-pop3d

10. Next, restart the Dovecot service using the following command.
$ sudo systemctl restart dovecot OR $ sudo service dovecot restart

Step 6: Installing Roundcube Webmail in Ubuntu
11. Roundcube is the webmail server that you’ll be using to manage emails on your server, it has a simple web interface to do the job, it can be customized by installing more modules & themes.
$ wget https://github.com/roundcube/roundcubemail/releases/download/1.4.8/roundcubemail-1.4.8.tar.gz $ tar -xvf roundcubemail-1.4.8.tar.gz $ sudo mv roundcubemail-1.4.8 /var/www/html/roundcubemail $ sudo chown -R www-data:www-data /var/www/html/roundcubemail/ $ sudo chmod 755 -R /var/www/html/roundcubemail/
12. Next, you need to create a new database and user for Roundcube and grant all permission to a new user to write to the database.
$ sudo mysql -u root MariaDB [(none)]> CREATE DATABASE roundcube DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; MariaDB [(none)]> CREATE USER roundcubeuser@localhost IDENTIFIED BY 'password'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON roundcube.* TO roundcubeuser@localhost; MariaDB [(none)]> flush privileges; MariaDB [(none)]> quit;
13. Next, import the initial tables to the Roundcube database.
$ sudo mysql roundcube < /var/www/html/roundcubemail/SQL/mysql.initial.sql
Step 7: Create an Apache Virtual Host for Roundcube Webmail
14. Create an apache virtual host for Roundcube webmail.
$ sudo nano /etc/apache2/sites-available/roundcube.conf
Add the following configuration in it.
<VirtualHost *:80> ServerName tecmint.com DocumentRoot /var/www/html/roundcubemail/ ErrorLog ${APACHE_LOG_DIR}/roundcube_error.log CustomLog ${APACHE_LOG_DIR}/roundcube_access.log combined <Directory /> Options FollowSymLinks AllowOverride All </Directory> <Directory /var/www/html/roundcubemail/> Options FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> </VirtualHost>
15. Next, enable this virtual host and reload the apache for the changes.
$ sudo a2ensite roundcube.conf $ sudo systemctl reload apache2
16. You can now access the webmail by going to http://yourdomain.com/roundcubemail/installer/
.

16. Next, go to the Database settings and add the database details.

17. After making all the changes, create a config.inc.php
file.

18. After finishing the installation and the final tests please delete the installer
folder and make sure that enable_installer
option in config.inc.php
is disabled.
$ sudo rm /var/www/html/roundcubemail/installer/ -r
19. Now go to the login page and enter the user name and the password of the user.
http://yourdomain.com/roundcubemail/

Step 8: Creating Mail Users
20. In order to start using the Roundcube webmail, you’ll have to create a new user, to do so, run.
$ sudo useradd myusername
Replace “myusername” with the user name you want, create a password for the new user by running.
$ sudo passwd myusername
21. Now go back to the login page and enter the user name and the password of the newly created user.
Have you tried to create an email server before? How did it go? Have you used Roundcube or any other mail server before? What do you think about it?
I followed every step I downloaded everything but the webmail said error 404.
@Mario,
Make sure to verify the file and directory permissions, ensuring that the web server has the necessary access to the files. Incorrect permissions could result in a 404 error.
Also, check your configuration settings to ensure they are correctly set up like database connections, and any other relevant configuration details.
Thanks for the helpful tutorial.
I have done everything, of course, I am using nginx. I got an error when I am using the command:
The error is:
I test 587 and 465 ports and they go the same. However, this one goes well: “telnet smtp.gmail.com 587”.
Now in my roundcube panel, I try to send an email and I get this error in the roundcube log:
And another problem is that I receive no emails. No emails are shown in my roundcube panel.
Does anyone know the solutions?
@Farhad,
The error message you’re encountering, “Network is unreachable“, typically indicates that your system is unable to establish a network connection to the target IP addresses.
This can be due to several reasons such as internet connection issues, network configuration issues, or firewalls or security software blocking a request…
The “Connection refused” and “Failed to connect socket” errors indicate that the Roundcube application is unable to establish a connection to the SMTP server.
I suggest you check your SMTP server configuration, firewall, or selinux restricting connection, or check that the PHP socket extension is enabled in the PHP configuration. Also, make sure to check SMTP server logs for more information.
I’m getting an smtp error on the test…
SMTP send: NOT OK(Connection failed: (Code: -1))”
Please help me…
I did the tutorial step by step and actually everything is working but it created a new ip and now I can’t do it locally (my local IP just to work in my virtual machines) and I can’t open the roundcube page because of it!, just the Apache default one that runs on my ip.
Hi, I’m new to this and in step 17 I got lost, I didn’t know how to create what “config.inc.php” asks for, I deleted the installer as requested, but now the domain no longer works for me, I get:
DATABASE ERROR: CONNECTION FAILED!
Unable to connect to the database!
Please contact your server-administrator.
I don’t know what to do, help.
@Alexis,
The config.inc.php file is saved to the /var/www/html/roundcubemail/config directory.
Please check if the file is there, if not, create config.inc.php file by using the defaults.inc.php file.
Hello Bro,
I have already installed the LAMP server on UBUNTU 22.04 Can I install postfix roundcube now or do I need a fresh machine? I am using DigitalOcean hosting.
Please reply as soon as possible.
My application is in trouble with e-mail
@Pardeep,
You can install the Roundcube email client on the same machine, no need to have a fresh system…
Okay, brother Thanks for the quick response…
How about ssl configuration for the mail server?
Is there any advantage to joining the Ubuntu machine to our Active Directory domain before installing the email server?
So I did everything like the turtorial but apache says that this url doesnt exist.
Have you registered your domain ??
Hello,
Is it possible to do this without a fixed IP address? With a dynamic DNS for example? Is it possible to change the DNS records automatically when the external IP changes?
Thanks,
Isaiah
Yeah, you can change the Records automatically with your script or a dyndns client. But with dynamic IP will not have the Reverse DNS that will be a problem for your mail server.
Can anyone please suggest a very good cloud server site apart from digitalocean and vultr?
Anyone with open port 25.
Linode Hosting – https://www.linode.com/
Hi all,
How to create users for dovecot?
I tried as mentioned in this tutorial but it’s impossible to connect in Roundcube.
@Jacques,
What error are you getting while logging into Roundcube as a user?
I can’t connect. I type in the login and password created as indicated but I can’t connect. I have no error message on the interface.
Someone, to help me?
How to create users who can connect to Roundcube?
My server is Ubuntu 20
I am sorry for my bad English, this my problem, with postfix in Linux.
I work in a single vps, with two wordpress,” contact form send mail just for mail “[email protected]”,
If I change file sasl_passwd like this contact form send mail just for "[email protected]",:
If I use shell to send mail like this, both cases work perfectly :
So I need to find a problem with config wordpress or config postfix?
If there solution how to send a message from both wordpress, please help,
Could you update the guide for SASL authentication (openssl) and thunderbird add email account please?
@John,
I Will update the article with SASL authentication and thunderbird as an email client soon…
I have a problem regarding step no 2 I am using the ubuntu 20.04 server but this command is not working terminal says unable to locate the package php-net-ldap3 kindly help me.
On point 16. access webmail. I get an URL not found.
Apache/2.4.41 (Ubuntu) Server at example Port 80
Hi, thank you for this tutorial! I do have one tiny problem though. When I want to access the login page it gives me ‘ Unable to connect to the database, please contact your administrator “. I followed everything to the point. please help!
Hi, may I use the PostgreSQL database for this setup?
I installed Roundcube as described in the HowTo. When I enter the server/install URL, I get a 404. If I enter the URL for the root of the server, I get the following:
CONFIGURATION ERROR
config.inc.php was not found.
Please read the INSTALL instructions!
I also noticed that there were no instructions for configuring the http.conf file, somehow there is something that is not being configured. Can you give me a couple of pointers on where to look?
@Frank,
Check Step 7, point 14 for Apache configuration for Roundcube…
Most of the buttons on the Roundcube interface are un-clickable and grayed out. Why is this?
In step 2, many packages could not be found (I use a Debian 10 server).
Terminal info:
root@Server007:/etc/apache2/sites-enabled# sudo apt install apache2 apache2-utils mariadb-server mariadb-client php7.4 libapache2-mod-php7.4 php7.4-mysql php-net-ldap2 php-net-ldap3 php-imagick php7.4-common php7.4-gd php7.4-imap php7.4-json php7.4-curl php7.4-zip php7.4-xml php7.4-mbstring php7.4-bz2 php7.4-intl php7.4-gmp php-net-smtp php-mail-mime php-net-idna2 mailutils
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package php-net-ldap2 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
Package php-net-ldap3 is not available but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Unable to locate package php7.4
E: Couldn’t find any package by glob ‘php7.4’
E: Couldn’t find any package by regex ‘php7.4’
E: Unable to locate package libapache2-mod-php7.4
E: Couldn’t find any package by glob ‘libapache2-mod-php7.4’
E: Couldn’t find any package by regex ‘libapache2-mod-php7.4’
E: Unable to locate package php7.4-mysql
E: Couldn’t find any package by glob ‘php7.4-mysql’
E: Couldn’t find any package by regex ‘php7.4-mysql’
E: Package ‘php-net-ldap2’ has no installation candidate
E: Package ‘php-net-ldap3’ has no installation candidate
E: Unable to locate package php7.4-common
E: Couldn’t find any package by glob ‘php7.4-common’
E: Couldn’t find any package by regex ‘php7.4-common’
E: Unable to locate package php7.4-gd
E: Couldn’t find any package by glob ‘php7.4-gd’
E: Couldn’t find any package by regex ‘php7.4-gd’
E: Unable to locate package php7.4-imap
E: Couldn’t find any package by glob ‘php7.4-imap’
E: Couldn’t find any package by regex ‘php7.4-imap’
E: Unable to locate package php7.4-json
E: Couldn’t find any package by glob ‘php7.4-json’
E: Couldn’t find any package by regex ‘php7.4-json’
E: Unable to locate package php7.4-curl
E: Couldn’t find any package by glob ‘php7.4-curl’
E: Couldn’t find any package by regex ‘php7.4-curl’
E: Unable to locate package php7.4-zip
E: Couldn’t find any package by glob ‘php7.4-zip’
E: Couldn’t find any package by regex ‘php7.4-zip’
E: Unable to locate package php7.4-xml
E: Couldn’t find any package by glob ‘php7.4-xml’
E: Couldn’t find any package by regex ‘php7.4-xml’
E: Unable to locate package php7.4-mbstring
E: Couldn’t find any package by glob ‘php7.4-mbstring’
E: Couldn’t find any package by regex ‘php7.4-mbstring’
E: Unable to locate package php7.4-bz2
E: Couldn’t find any package by glob ‘php7.4-bz2’
E: Couldn’t find any package by regex ‘php7.4-bz2’
E: Unable to locate package php7.4-intl
E: Couldn’t find any package by glob ‘php7.4-intl’
E: Couldn’t find any package by regex ‘php7.4-intl’
E: Unable to locate package php7.4-gmp
E: Couldn’t find any package by glob ‘php7.4-gmp’
E: Couldn’t find any package by regex ‘php7.4-gmp’
@Michael,
I think PHP 7.4 not included in the official Debian repository. If you still want to install PHP 7.4 on Debian 10, you need to enable SURY PHP PPA repository and then install PHP 7.4 on Debian 10 or Debian 9 as shown.
Install PHP 7.4 on Debian 10
Thanks for this tutorial. It was really helpful.
However, I can get emails from Roundcube but I cannot send emails from that interface. I get the following error: SMTP Error (-1): Connection to server failed.
Pretty much every package failed to load / could not be found when running step 2
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package php7.4
E: Couldn’t find any package by glob ‘php7.4’
E: Couldn’t find any package by regex ‘php7.4’
E: Unable to locate package libapache2-mod-php7.4
E: Couldn’t find any package by glob ‘libapache2-mod-php7.4’
E: Couldn’t find any package by regex ‘libapache2-mod-php7.4’
E: Unable to locate package php7.4-mysql
E: Couldn’t find any package by glob ‘php7.4-mysql’
E: Couldn’t find any package by regex ‘php7.4-mysql’
E: Unable to locate package php7.4-common
E: Couldn’t find any package by glob ‘php7.4-common’
E: Couldn’t find any package by regex ‘php7.4-common’
E: Unable to locate package php7.4-gd
E: Couldn’t find any package by glob ‘php7.4-gd’
E: Couldn’t find any package by regex ‘php7.4-gd’
E: Unable to locate package php7.4-imap
E: Couldn’t find any package by glob ‘php7.4-imap’
E: Couldn’t find any package by regex ‘php7.4-imap’
E: Unable to locate package php7.4-json
E: Couldn’t find any package by glob ‘php7.4-json’
E: Couldn’t find any package by regex ‘php7.4-json’
E: Unable to locate package php7.4-curl
E: Couldn’t find any package by glob ‘php7.4-curl’
E: Couldn’t find any package by regex ‘php7.4-curl’
E: Unable to locate package php7.4-zip
E: Couldn’t find any package by glob ‘php7.4-zip’
E: Couldn’t find any package by regex ‘php7.4-zip’
E: Unable to locate package php7.4-xml
E: Couldn’t find any package by glob ‘php7.4-xml’
E: Couldn’t find any package by regex ‘php7.4-xml’
E: Unable to locate package php7.4-mbstring
E: Couldn’t find any package by glob ‘php7.4-mbstring’
E: Couldn’t find any package by regex ‘php7.4-mbstring’
E: Unable to locate package php7.4-bz2
E: Couldn’t find any package by glob ‘php7.4-bz2’
E: Couldn’t find any package by regex ‘php7.4-bz2’
E: Unable to locate package php7.4-intl
E: Couldn’t find any package by glob ‘php7.4-intl’
E: Couldn’t find any package by regex ‘php7.4-intl’
E: Unable to locate package php7.4-gmp
E: Couldn’t find any package by glob ‘php7.4-gmp’
E: Couldn’t find any package by regex ‘php7.4-gmp’
@Ian,
Which Ubuntu release version you are using?
And before running install-jsdeps.sh you need to make overwrite the content of file jsdeps.json with this:
https://github.com/roundcube/roundcubemail/blob/master/jsdeps.json
UI does not work because of missing jquery.js files.
https://github.com/roundcube/roundcubemail/issues/5592
we need to execute bin/install-jsdeps.sh script to get those JS files.
Just in case people come across problem-related to packages php not loading, I had to install
over php7.4 to make it working.
sample error logs:
PHP Fatal error: Uncaught Error: Class ‘PEAR’ not found in /var/www/html/roundcubemail/program/lib/Roundcube/bootstrap.php:103\nStack trace:\n#0 /var/www/html/roundcubemail/program/include/iniset.php(62): require_once()\n#1 /var/www/html/roundcubemail/installer/index.php(43): require(‘/var/www/html/r…’)\n#2 {main}\n thrown in /var/www/html/roundcubemail/program/lib/Roundcube/bootstrap.php on line 103
wow.. thanks. Now I can send and receive email from my own domain… thanks for this clear tutorial…
@Winar
Many thanks for the useful feedback.
Why I cannot telnet to SMTP Gmail with port 25?
@Fandi,
Check Port 25 is opened on your UFW firewall and also make sure that port 25 listening on the TCP socket using the netstat command.
Wow, this article just popped up in my RSS reader today.
IMHO:
Why on earth SquirrelMail? I have used it 14 yrs ago on my 50MB webspace, but it seems like since then it has not evolved – besides security fixes – at all.
It might still work just good enough for its purpose, but I think there are a couple of modern alternatives…
@Sebastian,
We didn’t know that SquirrelMail development stopped. We will replace it with Roundcube.
I don’t know for sure that development has “stopped”.
I thought it still is maintained for security patches.
But take a look at its homepage, it has barely seen updates in the last 5-6 yrs.
TIA for updating. I also use Roundcube, it’s a good alternative!
I have updated the article and included Roundcube webmail as suggested by you…
I have this problem:
ERROR: Config file ‘. ‘”config/config.php” not found. You need to ‘ . ‘configure SquirrelMail before you can use it.
‘; exit; } // If we are, go ahead to the login page. header(‘Location: src/login.php’); ?>
Run ./configure and can’t access rahimpenfriends.ddns.net/squirrelmail
Hey, great tutorial. I had some problems at the end though.
If anyone is having the same problem on an Apache2 server, of
www-data
not being able to write to /var/local/squirrelmail/data you have to create the directories, use chown to give it towww-data
and give it write permissions with chmod.I am getting this error on my apache2 php7.3:- Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in /var/www/html/squirrelmail/functions/global.php on line 472.
Any solution??
I can’t access the domain.com, I have already made sure that everything was correct and as it is. Please help me and contact me on my email if you are willing to help. this is for my final project.
I’m not sure why, but I am able to send Emails yet I can’t receive them. I’ve tried sending an email to myself, and I followed this tutorial perfectly, with the addition of changing
$data_dir
to /var/www/html/squirrelmail/data/ so that my user can log in. I also opened ports 25,80,143,443.Please help me…
Hi Guys,
Everything went well until Step 4.12 When I put
karanpatel.co/squirrelmail
in a Google browser (from a different computer) it gives me “internal error – server connection terminated” or sometimes “503 Service Unavailable – No server is available to handle this request”.Just to add here, I’ve just recently bought this domain name for the sake of trying out to set up an email service on my Ubuntu VM (Ubuntu 19.10), I’ve got no website running with that domain – could that be a problem here?
Best Regards,
Karan Patel
How to point the domain to it?
You should install this package to allow PHP to interface with apache2:
Do not forget to edit the dir.conf file to make
.php
have higher precedence than.html
so that the mail server works. Afterward restart the server and it should workLoggin in with the user account is not a good idea tho. Most server configuration files can be read by all user and some of WordPress files can be written by all users (not by default). Your server will be vulnerable if one of your user accounts is exposed. It is better to use database based mail user account
I can receive emails but no one receives mine…
Got this message:
This is the mail system at host [DOMAIN].
I’m sorry to have to inform you that your message could not
be delivered to one or more recipients. It’s attached below.
For further assistance, please send mail to postmaster.
If you do so, please include this problem report. You can
delete your own text from the attached returned message.
The mail system
: host
gmail-smtp-in.l.google.com[2a00:1450:400c:c01::1b] said: 550-5.7.1
[2a02:c205:3002:4898::1] Our system has detected that this message
550-5.7.1 does not meet IPv6 sending guidelines regarding PTR records and
550-5.7.1 authentication. Please review 550-5.7.1
https://support.google.com/mail/?p=IPv6AuthError for more information 550
5.7.1 . d14si1503938wrn.307 – gsmtp (in reply to end of DATA command)
The problem seems to be Gmail related because outlook addresses get my emails…
Yeah I fixed it :)
Hi, first and foremost, this is a great page; I’m stuck in step 4.12 (installing SquirrelMail-access the webserver (login page)) because I’m getting the PHP code (plain text) instead of the login page in my browser.
I’m running an ubuntu 16.04 server and I will appreciate any help to fix this issue.
Hello there, I’m trying to set up my email, but when I try to log in, I get an error as below.
Error opening ../data/default_pref
Could not create an initial preference file!
/var/local/squirrelmail/data/ should be writable by user www-data
Please contact your system administrator and report this error.
What should I do?
@Katumba,
Make the following directory writable by user www-data.
I had an issue like “Error opening ../config/default_pref”
Could not create initial preference file!
/var/lib/squirrelmail/data/ should be writable by user www-data
Please contact your system administrator and report this error.”
I could fix it by changing the Data Directory in the General Options to /var/www/html/squirrelmail/data.
Hope this helps somebody
@MM,
Make the following directory writable by user www-data.
I work on my client’s Linux servers, and I found your article useful for me. I had permission issues though with the mail server but finally fixed it.
Thanks
@Adnan
Nice! Many thanks for the useful feedback.
I can’t
Hello,
I followed this article and the Sending mail work with @localhost and doesn’t work @mydomain.
I miss something?
FYI:
/var/log/mail.log & /var/log/mail.err doesn’t show error.
.
After sending it to user2@localhost, the sender has user1@mydomain and the mail is received by user2. by sending to user2@mydomain, nothing happens (status=bounced and nothing to tell that:25 is blocked = this mean it’s ok)
Regards,
@ElMokhtar
Have you tried using a valid domain like mydomain.com?
Hello Aaron,
I mean by @mydomain = (My FQDN, in my case hostname.mycountrycode)
@ElMokhtar
Are there any relevant entries in the /var/log/mail.err file?
Hi @ElMokhtar,
Maybe this can help :)
https://drive.google.com/file/d/17nii7skTJi9WfiGSs4BtNl24khY3nxBS/view?fbclid=IwAR1pa5DkFn_nIYUgNkq8mMInYKUFURs_4TJnxHeJBT8N_3kZ3RNRL6R7sOU
This is very grateful and easy to install and configure Postfix (MTA server), Dovecot (MDA server) and Squirrel (MUA server). this is how we can configure a complete mail server. Its easy and very fewer configurations involved.
I got the same error of permissions as:
Error opening ../data/default_pref
Could not create an initial preference file!
but it was resolved as I gave full rights to all required folders like:
Error opening ../data/default_pref
Could not create an initial preference file!
/var/local/squirrelmail/data/ should be writable by user www-data
Please contact your system administrator and report this error.
Hi there,
I read this article and follow all the instructions to set up the Squirrelmail and worked too.
When I login with myusername and password, it gives this error
ERROR
Error opening ../data/default_pref
Could not create an initial preference file!
/var/local/squirrelmail/data/ should be writable by user www-data
Please contact your system administrator and report this error.
This is the permission of folders
http://prntscr.com/qktqcb
.And second thing via command line using this command
usermod -m -d /var/www/etraininghq/etraining etraining
.usermod: no changes
Please help me if you have any solution.
Thanks in advance
Create the folder/folders, assign the perms to it, all good after that. It worked for me.
SquirrelMail version 1.4.22
By the SquirrelMail Project Team
ERROR
An unknown user or password is incorrect.
Go to the login page
I feel like a total noob which I am, but even after assigning perms to
myusername:myusername
the login just wouldn’t succeed. It still gives me the Query: CAPABILITY error, and then in the logs, it says mkdir() failed due to insufficient permissions.Hi, is it possible to login in thunderbird with this mail server?
@Anton,
Yes, you can use POP and Imap setting in Thunderbird to Login…
Oh okay thank you but where do I find my IMAP and SMTP link, because it’s asking me for this. And do I have to change some settings for this?
Simple question. can I build this on the same server I use to host my website? or does it have to be an independent server?
@Abraham,
Not an issue, you can host the Mail server on the same server with Apache.
Hi, This is a great guide, and I am a complete novice to all this. I have come across an issue and cannot figure out how to solve it.
When setting up, I got a screen asking about SSL as I have SSL setup on my server and a forced redirect to HTTPS. It asked me for a name, so I put in my hostname
mattemedia.co.uk
, and followed the rest of the guide.Now when I go to open SquirrelMail login, I get a 404 – not available on port 443…
@Matthew,
Please check the SSL and Mail logs, might you will find a solution to fix this problem..
I’ve checked the logs and it just says ‘mailbox could not be auto created’
Try the command
sudo a2enmod php7.0
.Hello, I have a question.
I don’t own a domain yet. But I wanted to know if it is possible to create a free domain such as “mydomain.com” and send emails from it? Or is it required of me to purchase the domain first?
You’ll need a domain name. Most, if not all mail servers will reject your sent email as it doesn’t show up in DNS
ERROR: Config file ‘ . ‘”config/config.php” not found. You need to ‘ . ‘configure SquirrelMail before you can use it.
‘; exit; } // If we are, go ahead to the login page. header(‘Location: src/login.php’); ?>
I have this problems, i have follow the guide
Try this commands:
In step 14 this command
usermod -m -d /var/www/html/myusername myusername
is not working for me says user mod no changes.anyway, I’m able to log in to the error screen.
then i use command
sudo chown -R myusername:myusername /var/www/html/myusername
and still get the IMAP error.(I’m supposed to replace my username in any of this for my actual user name ?) I’ve tried also not working.
your help is greatly appreciated
I have completed all steps and even I remove all folder and repeat all steps carefully still I faced error:
Please contact your system administrator and report this error.
@Muhammad,
Make the following directory writable by user www-data.
Thank you so much, Sir,
If I want to generate an email from laravel or python Django. How I will set laravel mail setting or Django?
..
and can you send me some tutorial or documentation of its? I am very thankful to you…
I have installed Squirrelmail as per your provided instructions. However, when I connect using Firefox I get a blank page.
Using Chromium I get connection refused by the server.
Login page isn’t opening for me. I have followed all the instructions. I cant access the login page. PLEASE HELP
@MZ,
Please check the logs..
Hello Sir,
I have followed your instruction to create the web server. But I can’t log in with the user I created and even root. I am using a virtual host. how can I create email user on the virtual host?
@Cooper,
Any error you getting while logging?
Error opening ../data/default_pref
Could not create initial preference file!
/var/local/squirrelmail/data/ should be writable by user www-data.
Please contact your system administrator and report this error.
I get this error and /var/local/squirrelmail/data is not exist.
What I did was that I copied “squirrelmail” folder that is in /var/www/html/squirrelmail copied to /var/local and did the permissions again, I dont know if I did it right or not but it seems to be working for me after doing that, correct if I am wrong @Ravi Saive
@TechNafo,
As per the instructions provided here, the step 4 clearly shows that squirrelmail installed under /var/www/html/squirrelmail and the
data
directory would be /var/www/html/squirrelmail/data.What can I do now? I had copied folder squirrelmail to /var/local manually because there was no folder in there.
@John,
Nothing, squirrelmail will work without any problems..
@TechNafo,
Please follow the Step 4: Installing SquirrelMail in Ubuntu properly…
But Step 4 does not talk about directory /var/local/ at all
@John,
Then, where you have installed your Squirrelmail? as per step 4 it will install under /var/www/html and data directory would be /var/www/html/squirrelmail/data.
I followed step 4 and I ended up with a folder “squirrelmail” in /var/www/html/ because I was having that error I mentioned before, all that I did was copy that folder “squirrelmail” to /var/local then I ran the commands again for permissions and that was it, it was fixed for me, I dont know if I was supposed to manually copy the folder to /var/local or not but I did.
I am following all the steps but I am getting this error message at the end after giving full permissions.
Error opening ../data/default_pref
Could not create initial preference file!
/var/local/squirrelmail/data/ should be writable by user www-data
Please contact your system administrator and report this error.
I checked mail.err but nothing in there
@John,
Make the following directory writable by user www-data.
It would appear that these directions are out of date or there is a repository that should be perhaps be mentioned where php5 can be obtained from.
@Tcullen,
I’ve updated the article and included latest instructions for setting up complete mail server using Postfix on Ubuntu.
i didn’t get any ssl configuration window while installing dovecot
Me neither.
I have configured almost everything and also the mail is working perfectly fine but my question is can’t we install squirrel administrator for managing all the users using web ui ?
@Sushant,
You can install Squirrelmail as explained in this article: .
Hello, @Sushant
Based on my previous setup of email servers through this tutorial. I haven’t found any web UI for managing squirrel mail users.
What I done is build a simple web UI and API using nodejs for CRUD users.
Hello this might help you.
I created this document based on this tutorial.
https://drive.google.com/file/d/17nii7skTJi9WfiGSs4BtNl24khY3nxBS/view?usp=sharing
@Chael,
That’s really nice and very helpful for newbies, who are new to setting up Mail Server. Thanks a ton..
Your welcome @Ravi
I’m glad to help.
If there’s any question on the document I will update it.
@Chael,
I have checked the document, it’s perfect, if any issues raised by users, I will definitely contact you. Thanks again…:)
Hi, in the part TXT vielsoft_dkim._domain. Where do i get those values??
@Edaurdo,
You need to create TXT values on the server for domain.
Thank you so much for taking some time out to break this down.
I am very grateful…
Hi, in the part, where do I get txt values?
Hello @Eduardo,
opendkim-genkey -t -s mail -d vielsoft.com
will generate the mail.txt in the current folder you executed the command
@Chael,
Thanks for sharing the command for creating TXT record for mail domain…
I’m unable to launch squirrel-email web UI, any help ?
Hi,
Many thanks for sharing this article.
However, my major problem is how to point the dns to enable it work. For example, i purchased my domain from gandi.net, what configuration must i do at the domain provider’s site?
And, how can I set up the following:
I have an account with digitalocean.com, where I have also created a droplet and have an IP for my domain. I have created a new record at digitalocean.com and I have changed the dns server information at gandi.net as ns1.mydomain.com and ns2.mydomain.com.
I have already setup Postfix Mail Server on my Ubuntu 14, although, without installing the squirrel mail, but while i was researching how to fix the above, i came across this post and i find it very helpful because I was able to add Squirrel Mail to my Postfix Mail, but still, nothing is working.
Please I really need your help to fix this.
@Dave,
In your domain control panel, point your domain A and MX records to your server IP address where Postfix installed.
Hello All,
I am not able to get to the web interface, page fails to load. Please help.
add the user to the mail group, this will resolve the inbox issue:
Hi ,
When I try to send any mail I got an error like:
“Service not available, closing channel
421 4.3.0 collect: Cannot write ./dfwAKAhJ3f108965 (bfcommit, uid=0, gid=119): No such file or directory”
Is there anybody give me a hand to rid out of it .
Thank
Hi Zac, I still have the error even though I added my user to the mail group. From my /var/llog/mail.err, I am getting this:
localhost dovecot: imap(myusername): Error: Opening INBOX failed: Mailbox isn’t selectable
Hello
During the installation of Dovecot did not execute the creation of SSL keys, how do I create at this time?
Another thing, following step by step, I still have a problem logging in to squirrelmail: ERROR: Connection dropped by IMAP server.
Can you help me?
Thank you.
Have you checked the log at /var/log/mail.err?
Maybe the permission or the existence of the folder is missing in /var/mail/myusername?
I still have the error though on localhost dovecot: imap(myusername): Error: Opening INBOX failed: Mailbox isn’t selectable.
Hi, did you manage to solve this issue yet?
When I tried to create a MX record on my server on DigitalOcean, there is a session that says [MAIL PROVIDERS MAIL SERVER] and the example in that field reads aspmx.|.google.com.
When I am trying to login it says: “You must be logged in to access this page.” How can I fix it?
@Rahu
I tried to send an email using the newly setup email server but, I don’t receive any email in my gmail. Does MX and SPF record, took times or days to be able my newly setup server to send email ?
Hi Chael. Both the MX and SPF records will take about two hours (depending on your location) to propagate to other DNS servers. I’ve heard of some cases of it taking a day, but not more than that.
@doug can you help me setup a simple email server ?
I already follow the tutorial and I receive email but sending email to my gmail doesn’t work.
I don’t know if I miss something from my dns config, [email protected] is my email. if you can help me
Hi, How do I link it up with SQL so that users will have the freedom to reset their passwords to their choice? and enable password reset option in the web interface?
Good tutorial, but I still get a time-out “ERROR: Connection dropped by IMAP server.”. Any ideas would be appreciated.
I am not able to receive mail in Inbox. Is there anything missed like DNS configurations or something?
@Rahu,
Does the mail received in Spam section? Have you added correct MX and SPF records for your mail domain?
Can your please explain that MX record and SPF record for my domain? Am using digitalocean and followed all above steps.
@Rahu,
Please check out the following article, and see the section – Create A and MX Records for Domain in DNS.
https://www.tecmint.com/setup-postfix-mail-server-and-dovecot-with-mariadb-in-centos/
@Rahu
MX (mail exchange) record is an entry in your DNS zone file that specifies a mail server to handle a domain’s email, and SPF(Sender Policy Framework) record is an entry in DNS zone file used to indicate to mail exchanges which hosts are authorized to send mail for a domain.
@Rahu
You will need (must have) a MX record in your DNS configuration. An example would be:
A SPF (Sender Policy Framework) helps other email servers (like Gmail) to let them know that you are a legitimate email server and not pumping out spam. A SPF record would look something like this:
This is the one that I use and it has passed all spam filters and gmail.
Hi! I would like to ask what I should do if I have already installed an SSL certificate. Should I install a new certificate during the Dovecot installation or I could expand my certificate.
How can I connect my email with Outlook?
Excellent excellent excellent and thanks
On SquirrelMail, I get an error:
ERROR: Could not complete request.
Query: SELECT “INBOX”
Reason Given: [SERVERBUG] Internal error occurred. Refer to server log for more information. [2018-04-06 18:33:43] (0.000 + 0.000 secs).
add the user to mail group
adduser username mail
How to do that thanks you ?
sudo adduser username mail
please, Can you do me a favor ? I send mail but not receive mail.
Dec 29 10:21:44 presta-final dovecot: imap-login: Fatal: Can’t load ssl_cert: There is no valid PEM certificate. (You probably forgot ‘<' from ssl_cert=<)
I am facing problem regrading ssl certificate, help me!
me too the terminal for entering ok and host name not showing up
i tried to send email from my vps to gmail, but the email goes to the spam folder. how to fix it?
@januri,
Please setup Mail domain MX, SPF and TXT record in DNS control panel of your domain hosting..
I don’t use domain or hosting. i use vps digitalocean. where to get that (MX, SPF, TXT)?
@Januri,
You must have valid domain with MX and SPF records to send mails to top mail providers like Gmail, Hotmail, etc..
I can’t access squirrel mail address on my pc.
How can i open the squirrelmail after finish setup at Ubuntu terminal???
Hey i have set up the mail server using this tutorial, now i ab able to send the mails, but not being able to receive the mails, can anyone help me in that, i think its MX record problem in DNS, so what should i put in MX record in DNS ?
have you got any solution because i faced the same problem.if yes then please tell me how to fix this problem.
My squirrel mail is not working from last 10 days. It shows “Unknown user or password incorrect”
Please tell me step by step troubleshooting.
Hi there, How can i add auto response feature in squirrel mail, I know that we can add from backend by installing auto response package, but How can we add auto response plugin to squirrel mail?
Thank you for the amazing tutorial,
I have been trying to setup my email server for as long as i can remember, and i never got it right until this time.
The steps are missing to give the username permissions to create an Inbox.
https://serverfault.com/questions/713635/postfix-dovecot-squirrelmail-failed-to-autocreate-mailbox-inbox
The first line of the dovecot error indicates it doesn’t have permission write to /var/mail/. This indicates the dovecot is running under an account without permission to write to the folder. /var/mail/ is owned by root:mail (UID/GID 0:8), giving full read/write/execute permissions to both root and the group mail.
Dovecot is running under nicolai to access it, and because nicolai is not in the group mail, the folder cannot be accessed.
I’m not sure how the other inbox folders got created, but to fix this, all you should need to do is add nicolai to mail, like this:
That should allow nicolai to access it’s mail folder, and fix the problem.
Thank you so much. First I had got the same problem, however, I solved it by your method.
I tried, but not connecting to squirrel mail in my computer, looks like something is missing in this tutorial.
When I try to log into my Squirrelmail web interface there comes this:
Error connecting to IMAP server: timetoplaymc.de.
111 : Connection refused
What can I do? What is wrong?
NICE AND SIMPLE WAY TO TEACH THE SCRIPT
May 30 15:19:05 mailaitlb dovecot: imap(myusername): Error: open(/var/mail/myusername) failed: Permission denied (euid=1003(myusername) egid=1003(myusername) missing +w perm: /var/mail, we’re not in group 8(mail), dir owned by 0:8 mode=0775)
May 30 15:19:05 mailaitlbdovecot: imap(myusername): Error: Failed to autocreate mailbox INBOX: Internal error occurred. Refer to server log for more information. [2017-05-30 15:19:05]
I’m getting this error. Please help me.
Hello After completion of all the step mention. I wanted to access the server through browser but it showing not found. Can you assist
hello is it use for bulk email
Hi, is it possible to sync with outlook with this configuration? how can i do?
Thanks,
Sendmail not working after following this instruction and this is not sending any mail.
my domain name is dima.lb
I try to send mail but the same error appear every time : “Requested action not taken: mailbox unavailable 550 5.1.1 : Recipient address rejected : gmail.com”
Can anyone help me
what I have found is that this is most likely gmail’s spam filter blocking you. This is usually for new domains and stuff. To test this send an email to a yahoo account and see if it goes through. I have yet to find a fix for this issue though.
I meant spam filter, not firewall. *sigh* This is why you should always proofread things and why forums and comment sections should always have an edit button.
It works good, but how can I configure it to Icedove.
I also want to configure my webmail on my mobile phone.
Thank you.
Hi Sir,
This is very nice guide, I’ve don the configuration, unable to login with domain. Can you please help me, how to login with domain. How to enable virtual domain. Please help me, this is very nice really very great sir.
@Mahesh,
Have you added correct DNS and MX records for your domain?
Hi,
Thanks for the tutorial. Is this possible to install on the same server as my website? I use nginx and ruby on rails on my website. If I install this, will it not be causing conflicts?
Thanks
@Clint,
You can install Postfix on same Linux server without any issues, it will not conflict with your web server or applications..
Please create user with these step,
# useradd username
# passwd usernmae
# cd /home
# cd username
# mkdir mail
# cd mail
# mkdir .imap
# cd imap
# cd .imap
Please do it step by step and dont try to create directory like /home/username/mail
You can say it is crazy but I did face same problem and I fix it the say way.
Regard
# mkdir INBOX/
# cd INBOX
Hello,
thank for tuto :)
in the final step i got this error :
ERROR: Could not complete request.
Query: SELECT “INBOX”
Reason Given: [SERVERBUG] Internal error occurred. Refer to server log for more information. [2016-09-11 16:04:43]
i use ubuntu 14.04
Best regards,
Login as super user and do this command.
useradd myusername mail
This worked for me with the exact same error.
I gave the domain name as superstar.org. Now when I type superstar.org/squirrelmail in the browser,I just get a blank screen.what should I do ?
where we need to type example.com/squirrel
Did you manage to solve this issue.
Because I’m not getting redirected to the squirrelmail login page after typing this in browser’s address bar
In install devcot step system didn’t asked for create a self-signed SSL certificate
Any one having any Idea why this happened ?
Does it will create any problem?
how to configure this for email clients like thunderbird ?
Hey guys,
First of all thank you very much for this genius tutorial =) With this step-by-step procedure it was quite easy to set up a Mail Server.
But I think there is a little mistake in the $ usermod -m -d /var/www/html/myusername command. ( It didn’t work for me and since I am a Linux-newbie i didn’t notice it at first so I had to ask a colleague).
He told me that it should be : “$ usermod -m -d /var/www/html/myusername myusername“.
I hope this will help some of the newbies to come =)
Have a nice day =)
@Chris,
Your colleague is absolutely correct, the command should be:
As per you commands suggestions, I’ve corrected the command in the writeup..
sorry i didn’t get the difference between the both of the commands.
Hello every one, could you help me please, i not speak or write english perfectly, but i will try. I have an error when i try to login trough the web browser, the error says: NOT FOUND The requested URL /webmail/ was not found.
please help me
regards
did you manage to fix it ?
I have the same problem
Do you have correct MX record set for you domain in DNS control panel? if not, please set it first to receive mails from outside domains..
– This is my set-up. I created two separate servers for app and mail in AwS. My app server owns the domain. In my mail server, I installed Postfix, dovecot and squirrelMail. Now the problem is how can I now set the MX record? Please help. Thanks
@Marsha,
Go to your domain control panel, where you’ve purchased domain and add the MX record like mail.domain.com with priority 10 and 20..
Followed the steps above. Sending email works but I cannot receive emails. Can you help? Thanks!
@Marsha,
Do you have correct MX record set for you domain in DNS control panel? if not, please set it first to receive mails from outside domains..
i have install the squirrel mail in Ubuntu VM but i getting the error unknown user or password incorrect on login time please help
@Ravi Saive,
Question
I have a postfix server which is running on Ubuntu,Somehow my server is blacklisted with some xxx.com due this the xxx.xom is not allowing incoming emails from my server. so can I forward the emails which are in queue (postfix) to another postfix server to send those deffered emails ?
Can someone help me how can I achieve this ?
@Kiran,
Yes, you can forward incoming mails from other Postfix mail server using relay option.
@Ravi Saive,
Thank you for your prompt reply. The relay option which you are referring to is “relayhost” in postfix main.cf file ?
If yes if I add the IP to the relayhost parameter will that do the trick ?
Thank you in advance.
@Kiran,
Yes, hopefully it will do the trick…
that command doesn’t work for me
usermod -m -d /var/www/html/myusername
Usage: usermod [options] LOGIN
Options:
-c, –comment COMMENT new value of the GECOS field
-d, –home HOME_DIR new home directory for the user account
-e, –expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
-f, –inactive INACTIVE set password inactive after expiration
to INACTIVE
-g, –gid GROUP force use GROUP as new primary group
-G, –groups GROUPS new list of supplementary GROUPS
-a, –append append the user to the supplemental GROUPS
mentioned by the -G option without removing
him/her from other groups
-h, –help display this help message and exit
-l, –login NEW_LOGIN new value of the login name
-L, –lock lock the user account
-m, –move-home move contents of the home directory to the
new location (use only with -d)
-o, –non-unique allow using duplicate (non-unique) UID
-p, –password PASSWORD use encrypted password for the new password
-R, –root CHROOT_DIR directory to chroot into
-s, –shell SHELL new login shell for the user account
-u, –uid UID new UID for the user account
-U, –unlock unlock the user account
-v, –add-subuids FIRST-LAST add range of subordinate uids
-V, –del-subuids FIRST-LAST remvoe range of subordinate uids
-w, –add-subgids FIRST-LAST add range of subordinate gids
-W, –del-subgids FIRST-LAST remvoe range of subordinate gids
-Z, –selinux-user SEUSER new SELinux user mapping for the user account
@Williams,
You should be root or use sudo command to run that usermod command.
Hi,
I am stuck at this screen even after you suggest the command, still getting the same error:
ERROR: Connection dropped by IMAP server
@Anand,
To fix such issue, open the
/etc/dovecot/dovecot.conf
file and add the following line in the IMAP section:Restart dovecot:
Hi, Thanks for the reply and instruction.
there is no IMAP section in default /etc/dovecot/dovecot.conf, but I have added the above line in /etc/dovecot/conf.d/20-imap.conf.
Still no luck, getting same error.
No need for what he told you here is easy way
Added to /etc/dovecot/conf.d/10-mail.conf
mail_location = maildir:~/Maildir
and 100% it will work i followed the tutorial to but i got this mistake untill i searched the error in mail.log and this was the solution
Hi, Now I am getting different error after I restarted the System.
Error connecting to IMAP server: localhost.
111 : Connection refused
@Anand,
Better, could you post output of the web mail server’s log file for
IMAP server: localhost
error by executing the following commands:I think its time for this guide to get an big update.
@Matt,
Yes I completely agree with your suggestion that this guide really needs an update and we’re in process to update this article with new instructions very soon. Also if you’ve anything in mind that needs to be added to this article, do suggest us..
Hi there,
I followed the instruction until step 14 where I’ve got 404 error trying access to mydomain.com/squirrelmail.
Do you have any suggestions?
Thank you
@Gio,
Have you checked in “/var/log/mail.err” file for any error messages, if not please check and correct it or if possible could you post the mail.err logs here.
can i request your contact number please
@Vijay,
Please contact us at [email protected] for any questions or queries..
Hi,
Any one help me to fresh installation steps for squirrelmail in centos 6
Purpose : sending bulk mail.
@Vijay,
Just enable epel repository to install fresh Squirrelmail on CentOS or follow official docs here: http://squirrelmail.org/docs/admin/admin-3.html
Do you have a tutorial on how to setup such mail client on centOS 7?
Can I create unlimited email account with such tutorial?
@Ugo,
Yes, we’ve a complete tutorial on Mail server setup with Postfix at:
i have configured squirrelmai on 2 system , i follow all the step one by one ,i am able to send mail to local user or other domain user but i am not able to receive email from other domain user .
@Rakesh,
Have you set correct DNS A Record, MX, and SPF for your domain to receive mails?
same issue is happening to me :( . i am able to send mail to gmail user but i am not able to receive email from it.
Gmail error :
The error that the other server returned was:
Recipient not found. .
It helped a lot thanks for the steps…
It Works!! Many thanks.
The Squirrelmail works perfectly!
But when i try set an account using Thunderbird, the /etc/log/mail.log say
Nov 28 00:46:44 ip-172-31-44-39 postfix/submission/smtpd[13614]: improper command pipelining after EHLO from unknown[159.16.X.X]: QUIT\r\n
Any Idea!
Regards!
It gives me a SQL error
ERROR: Could not complete request.
Query: SELECT “INBOX”
Reason Given: [SERVERBUG] Internal error occurred. Refer to server log for more information. [2015-11-15 23:27:29
@Miquel,
Could you please check /var/log/maillog for any specific entries related to the error?
I had a similar error and this is the log:
imap(marclar): Error: open(/var/mail/marclar) failed: Permission denied (euid=1007(marclar) egid=1007(marclar) missing +w perm: /var/mail, we’re not in group 8(mail), dir owned by 0:8 mode=0775)
Jan 6 00:07:50 jasonrules dovecot: imap(marclar): Error: Failed to autocreate mailbox INBOX: Internal error occurred. Refer to server log for more information. [2016-01-06 00:07:50]
@Jason,
Open and add the group mail to the line “mail_privileged_group = ” in /etc/dovecot/conf.d/10-mail.conf file, then stop and restart the dovecot Hope it will solve this error.
I can host my email server, in Ubuntu 14, first it is not gui, my site is hosted anywhere else, i want to make my own email server, with already hosted site that is with third party now.
Hi, I have ran the command: sudo chown -R myusername:myusername /var/www/html/myusername (with my correct user name), yet i still keep getting the “ERROR: Connection dropped by IMAP server”
I have checked and I have both IMAP (port 143) and IMAPS (port 993) open (i am doing this on an azure linux vm, so they are set up as endpoints on the vm)
any suggestion on what else i would need to do?
@Dave,
To resolve such an error open dovecot.conf file and add the following line in the IMAP section:
If the above solution doesn’t work try to increase the client_limit from 100 to 1000 in same dovecot.conf file.
If any of the above solution, doesn’t resolve your problem, you should check out the Squirrelmail IMAP problem guide at
http://squirrelmail.org/wiki/MailServerIMAPProblem
Hello,why i cannot access to example.com/squirremail ? can anyone help me?
@Mori,
Does your example.com domain resolves to your server IP address? have you set correct A record for your domain in DNS?
hello, i followed procedure, but when I try to access mail server: ERR_NAME_NOT_RESOLVED, impossible to find DNS.
I registered a domain and I think I should use default DNS.
Thanks to everyone
@Giuseppe,
Please check your DNS settings, is your domain resolves?
I dont know how to check my DNS. I dont know how to setup my DNS in squirrelmail :(
@Giuseppe,
Does your domain resolves to your server IP address? I am sure your domain DNS is not properly set in your DNS manager of your domain hosting..
mmm I dont know…So what do I should do? Changing default domain settings using my IP settings? If it’s correct, how can I do that? Thanks and sorry for the questions :)
@Giuseppe,
Very difficult me to help you friend, no problem could you please tell me your domain name? so that I can do some DSN testing on my end..After that I can provide you correct solution.
Thanks Ravi Saive, my domain is: studiolegaleraimondi.ch. Thanks for helping!
@Giusseppe,
I check your domain not resolving properly, you need to set A record and point the domain to Server IP address to work everything perfectly, I suggest you to consult your DNS provider..
ok, thank you very much, the problem is that I just buyed domain and I need an hosting service. But I would not buy an hosting and do it by myself.
@Giuseppe,
If you want I can setup, but will charge you…
Hi everyone! I’m having some issues during the set up process. I do every step as it’s explained here but when I wanna go to example.com/squirrelmail it throws me 404 error. I’ve noticed that Squirrelmail is installed in /etc/squirrelmail… and I think… how could I in any way link those 2 folders to work together? I don’t know if I’m clear. I want to link /etc/squirrelmail with /var/www/username where my server is, to make squirrelmail work from there. So that way I could access. I’ve tried command ln folder folder but it says it’s impossible to make a hard link between folders…. so I’ve tried ln -s folder folder… but it’s still not working.
Any help would be very appreciated.
@Carolina,
Have you copied default squirremail Apache configuration file under apache2 directory in order to access the squirrelmail web? if not do,
And enable it using:
Now try to access the web page of squirremail again and see..
Hello, thia article was very helpful, thanks a ton.
i m getting a mail to my spam box.
1> I m sending to gmail account
2> i am not able to send mail back to the user from gmail account ,
it says as
Delivery to the following recipient failed permanently:
[email protected]
Technical details of permanent failure:
Google tried to deliver your message, but it was rejected by the server for the recipient domain mydomain.com by aspmx.l.google.com. [2607:f8b0:4003:c0a::1b].Delivery to the following recipient failed permanently:
[email protected]
Technical details of permanent failure:
Google tried to deliver your message, but it was rejected by the server for the recipient domain inertiagroups.com by aspmx.l.google.com. [2607:f8b0:4003:c0a::1b].
@Lokendra,
Firstly, you must have a Mail MX record for you mail domain to deliver mails to user inbox, and secondly a user must exists on the system to receive mail from outside, if user do not exists you will get a message as stated in your question..
It’s not login.I’ve got 404 error
@Hamid,
Where you getting 404 error? can you tell us more so that we can help you out..
I can only login with localhost/squirrelmail and send email . but when I login with example.com/squirrelmail I’ve got 404 error. I set my IP in sever and 25 port .
@Hamid,
I think you should check that your domain example.com is resolving DNS properly? have you correctly configured Apache to server squirrelmail?
Hi.I got this error when login
“ERROR: Could not complete request.
Query: SELECT “INBOX”
Reason Given: [SERVERBUG] Internal error occurred. Refer to server log for more information”
I am stuck at step 16, First part ok, it creates the folder but each time i run the usermod, it simply show a list of correct way to run command. it does nothing else. ANy tip for that?
@Mike
Your question is not clear to me, can you please tell me exactly what you looking for..
I felt your pain. The correct syntax of the command is “sudo usermod -m -d /var/www/html/username username”. The ” username” (note the leading space) was omitted.
I also had to make the following modifications in /etc/dovecot/conf.d/10-mail.conf:
mail_location = mbox:~/mail:INBOX=/var/mail/%n
mail_privileged_group = mail
At the moment, SquirrelMail works, but the “Check mail” link does not refresh my INBOX. However, clicking the “INBOX” link in the left pane does refresh my mail.
I solved my INBOX refresh issue. I changed the auto refresh:
Log into Squirrelmail from your browser of choice
Goto Options > Folder Preferences
Change Auto Refresh Folder List to 30 seconds
and loaded the Folder Synchronization plugin:
http://squirrelmail.org/plugin_view.php?id=64
Thanks!!!
@Stephen,
I am glad that you’ve resolved the issue yourself and thanks for mentioning your findings, hope it will help others too..
Hi,
Great article but even after giving ‘myusername’ full access to its homedir I still get
‘ERROR: Connection dropped by IMAP server.’
Anything else I can try?
When installing postfix I never got to the configuration screen “During installation, you will be asked to choose the default file configuration for your server.” Therefore I never was able to setup the domain name or user. How can I get that dialog?
dpkg-reconfigure postfix
This will let you reconfigure the service.
ERROR HERE! :_(
[email protected]:/var/www/html# usermod -m -d /var/www/html/correo1 correo1
usermod: without changes <—— DO NOTHING!
Can you help me? Thanks in advice.
Hello , can anyone help me with this error pls ?
May 8 12:34:36 Server dovecot: imap(faxarena): Error: user faxarena: Initialization failed: Namespace ”: mkdir(/var/www/html/mail) failed: Permission denied (euid=1019(faxarena) egid=1019(faxarena) missing +w perm: /var/www/htm$
May 8 12:34:36 Server dovecot: imap(faxarena): Error: Invalid user settings. Refer to server log for more information.
May 8 12:37:05 Server dovecot: imap(faxarena): Error: user faxarena: Initialization failed: Namespace ”: mkdir(/var/www/html/mail) failed: Permission denied (euid=1019(faxarena) egid=1019(faxarena) missing +w perm: /var/www/htm$
May 8 12:37:05 Server dovecot: imap(faxarena): Error: Invalid user settings. Refer to server log for more information.
May 8 12:37:09 Server dovecot: imap(faxarena): Error: user faxarena: Initialization failed: Namespace ”: mkdir(/var/www/html/mail) failed: Permission denied (euid=1019(faxarena) egid=1019(faxarena) missing +w perm: /var/www/htm$
May 8 12:37:09 Server dovecot: imap(faxarena): Error: Invalid user settings. Refer to server log for more information.
Why my way for mail /home/myusername and not /var/www/html/myusername?
I must exchange the way for email work.
Thanks.
usermod -m -d /var/www/html main
usermod: user ‘main’ does not exist
any help?
@Musa,
Sorry that was not ‘main’, it should be ‘myusername’..corrected in the writeup..
hi , i need to do this tutorial for nginx, not for apache2, because i use nginx and i don’t have apache2 installed on my server dedicated. i want to login with e-mail adress like ([email protected] and password) , not with username and password, to use my e-mail adress in outlook . How i doo this? Kane you make a tutorial like this one? But with nginx instead apache2 and for debian 7 x86?
Ty and sorry for my bad english.
your tutorial is nice here. you just forget this piece for squirrel mail
sudo ln -s /etc/apache2/sites-available/squirrelmail /etc/apache2/sites-enabled/squirrelmail
Oh we don’t need it, step 13 does the job.
Error connecting to IMAP server: localhost.
111 : Connection refused
Please check the log file.
I have the problem that after every step still tells me.
Forbidden
You don’t have permission to access /squirrelmail on this server.
Hello.
Have you tried changing the permissions of the folder to 755 and give privileges to the www-data user ?
Error “an2ensite command not found” on LinuxMint 17, how I can fix it?
@MRH,
Sorry for the trouble, that was a type..corrected in the article..
Thanks for your troub
Hi,
I found your article from Technotes blog. I followed your instruction smoothly until the step “sudo an2ensite squirrelmail.conf”. I got the response that “-bash: an2ensite: command not found”. Could you let me know what I should do to fix that? Thanks.
Hello twinclouds.
There’s a typo in this command, the correct one is this:
$ sudo a2ensite squirrelmail.conf
Thanks!
good article.
thank you it’s a goog article, please i need tutoriel creating a complete mail server setup in CentOS with RoundCube.
Thanx
can still write about the spam filter, antywirus?
how to do the above in rpm distro (CentOS)
@Deepanjan,
This guide is specially for Debian based distros, it will won’t work on CentOS, we are in process of creating a complete mail server setup in CentOS…stay tuned for this article..