Author |
|
roguitar Newbie
Joined: 07 September 2020 Location: Brazil
Online Status: Offline Posts: 9
|
Posted: 07 September 2020 at 6:08am | IP Logged
|
|
|
Hey, I didn't understand quite well how to set this part here. I have a VPS, Ubuntu 20.04 and I don't know if I have to have Postfix and SMTP configured previously. All I want is an email like admin@mysite.com. I already have a subdomain like mail.mysite.com. At this moment, I'm on the page https://mysite.com/webmail/#admin/mail-servers/create. Now what do I put here in IMAP and SMTP servers? Can someone give me a thourough explanation? Thanks.
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6103
|
Posted: 07 September 2020 at 6:26am | IP Logged
|
|
|
First of all, you do need to have functional mailserver backend, both IMAP (Dovecot, Courier etc.) and SMTP (Postfix, Exim etc.). One of the solutions I'd probably recommend is iRedMail which is a full-featured mailserver solution quite easy to manage.
You don't really need a separate subdomain for your mailserver, you can simply use your primary hostname, but what you're definitely going to need is MX record for your domain name - in the simplest case, that will be just one record with the same hostname as domain itself. But in fact, you can leave setting up that part till later, as sending/receiving mail within local mailserver (from/to the same address, or between two mailboxes on your local server) will work anyway.
Once you have your mailserver up and running, you can try accessing IMAP account with one of desktop email clients like Mozilla Thunderbird, or just proceed directly to using WebMail Lite with it.
Hope this helps.
--
Regards,
Igor, Afterlogic Support
|
Back to Top |
|
|
roguitar Newbie
Joined: 07 September 2020 Location: Brazil
Online Status: Offline Posts: 9
|
Posted: 07 September 2020 at 7:40am | IP Logged
|
|
|
Igor wrote:
First of all, you do need to have functional mailserver backend, both IMAP (Dovecot, Courier etc.) and SMTP (Postfix, Exim etc.). One of the solutions I'd probably recommend is iRedMail which is a full-featured mailserver solution quite easy to manage.
You don't really need a separate subdomain for your mailserver, you can simply use your primary hostname, but what you're definitely going to need is MX record for your domain name - in the simplest case, that will be just one record with the same hostname as domain itself. But in fact, you can leave setting up that part till later, as sending/receiving mail within local mailserver (from/to the same address, or between two mailboxes on your local server) will work anyway.
Once you have your mailserver up and running, you can try accessing IMAP account with one of desktop email clients like Mozilla Thunderbird, or just proceed directly to using WebMail Lite with it.
Hope this helps.
--
Regards,
Igor, Afterlogic Support |
|
|
Great, so first, I need to install Postfix and Dovecot in my Ubuntu, right? I always follow this tutorial here to install Postfix and Dovecot:https://www.ait.com/tech-corner/11480-how-to-setup-postfix-and-dovecotnbspon-a-vpsnbsp. Do you think it's a good tutorial to follow? I just didn't understand that part when you recommend iRedmail. I already have Afterlogic installed in my folder webmail (https://mysite.com/webmail), so do you mean I still need another webmail client like iRedmail? If I install iRedmail, I don't need to install Postfix and Dovecot, right? Sorry, I'm a beginner at this email configuration universe. And as for the email domain, I'd like something like admin@mysite.com and not like admin@mail.mysite.com.
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6103
|
Posted: 07 September 2020 at 11:40pm | IP Logged
|
|
|
Hello,
Quote:
I always follow this tutorial here to install Postfix and Dovecot:https://www.ait.com/tech-corner/11480-how-to-setup-postfix-and-dovecotnbspon-a-vpsnbsp. Do you think it's a good tutorial to follow? |
|
|
Yes, that looks good.
Quote:
I just didn't understand that part when you recommend iRedmail. I already have Afterlogic installed in my folder webmail (https://mysite.com/webmail), so do you mean I still need another webmail client like iRedmai |
|
|
Well no, iRedMail is a mailserver bundle, not a webmail client. I suggested it as an alternative for installing and configuring Postfix and Dovecot manually.
Quote:
If I install iRedmail, I don't need to install Postfix and Dovecot, right? |
|
|
Yes, that's right.
Quote:
And as for the email domain, I'd like something like admin@mysite.com and not like admin@mail.mysite.com. |
|
|
No problem with that, I believe that's how it would work by default.
--
Regards,
Igor, Afterlogic Support
|
Back to Top |
|
|
roguitar Newbie
Joined: 07 September 2020 Location: Brazil
Online Status: Offline Posts: 9
|
Posted: 01 March 2021 at 12:31pm | IP Logged
|
|
|
https://ibb.co/WG8m3zw
Ok. I think I got it. Now what's the next step. What do I have to do to make it work and start to receive emails from external sources instead of working only in localhost?
Another question I have is related to the fields: IMAP server and SMTP server. Where do I locate them? I used my domain name (olimppi.us). Is that correct? Look here: https://ibb.co/NjGP992
That's what I did: I installed iRedMail and postfix and dovecot are working
Igor wrote:
... You can simply use your primary hostname, but what you're definitely going to need is MX record for your domain name |
|
|
I created at Hostinger, in my VPS, an MX with the domain name olimppi.us. You said that it's really necessary, but I didn't understand for what and when I insert it.
Igor wrote:
Once you have your mailserver up and running, you can try accessing IMAP account with one of desktop email clients like Mozilla Thunderbird, or just proceed directly to using WebMail Lite with it. |
|
|
In reality, that's what I did: I proceeded directly to WebMail Lite and saved the settings. I think I can't use Mozilla Thunderbird because it's a VPS host, and I haven't installed any cpanel, and I have no graphical interface in my Ubuntu 20.04.
Now, all I want is to be able to send an email from gmail, for instance, in order that it can be deliverd to postmaster@olimppi.us. Thank you. Almost there.
Also, I took a test by sending an email to myself and that message showed there: "The username or password you entered is incorrect. (MailSo-Smtp-Exceptions-LoginBadMethodException)". Why is that the case?
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6103
|
Posted: 01 March 2021 at 11:39pm | IP Logged
|
|
|
I did run a check on your domain, it appears that Postfix is running there indeed ("telnet olimppi.us 25"). It may require additional configuration though.
When mentioning Mozilla Thunderbird, I meant running it on your local computer and from there, connect to your mail server via IMAP and SMTP, just to make sure everything works as expected and it's not WebMail configuration issue, usually it's all about DNS or mailserver setup.
The point of MX record is to tell the world: "hey, my domain is mydomain.com, and the mail server that handles email for me is mail.olimppi.us, please send all your mails to that one". But in the most typical case, domain and MX record will match - as in, will point to the same address. I see you currently have mx1.olimppi.us and mx2.olimppi.us added but you only need one, and you need it to be A or CNAME (actual record or alias) for olimppi.us.
Also, you don't need to worry about IMAP/SMTP hostnames, supplying olimppi.us as shown on the screenshot would work just nicely.
As for LoginBadMethodException, my guess would be that Postfix is configured to support only highly-advanced authentication mechanisms such as DIGEST-MD5 or CRAM-MD5. For the majority of WebMail clients to work, you need to make sure AUTH LOGIN method is enabled. To check if the method is enabled, connect to SMTP server via telnet and check capabilities, e.g.:
Code:
telnet yourdomain.com 25
...
EHLO localhost |
|
|
If things are good, the output should have something like:
and you should be able to send mail from that server with WebMail.
--
Regards,
Igor, Afterlogic Support
|
Back to Top |
|
|
roguitar Newbie
Joined: 07 September 2020 Location: Brazil
Online Status: Offline Posts: 9
|
Posted: 02 March 2021 at 7:42am | IP Logged
|
|
|
Ok. Now I changed the configuration a bit in Webmail Lite and here it is:
https://ibb.co/cXXgGSg
That means that now I can send messages to myself locally. Also, I can send emails externally. But I can't receive emails externally yet.
Igor wrote:
The point of MX record is to tell the world: "hey, my domain is mydomain.com, and the mail server that handles email for me is mail.olimppi.us, please send all your mails to that one". But in the most typical case, domain and MX record will match - as in, will point to the same address. I see you currently have mx1.olimppi.us and mx2.olimppi.us added but you only need one, and you need it to be A or CNAME (actual record or alias) for olimppi.us. |
|
|
Ok. So could I leave only olimppi.us there instead of mx1.olimppi.us and mx2.olimppi.us? I think that this A record you mentioned is already there. So I think I don't need to create a new one. Look:
https://ibb.co/GPzKgQJ
And after executing the command 'telnet olimppi.us 25', that's the output:
Code:
Trying 93.188.161.22...
Connected to olimppi.us.
Escape character is '^]'.
220 host.olimppi.us ESMTP Postfix |
|
|
After reading these two tutorials here, I don't know exactly why I'm not receiving emails: https://www.vivaolinux.com.br/topico/Postfix/Erro-554-571-Relay-access-denied-no-Postfix and https://www.hostinger.com.br/tutoriais/o-que-e-um-registro-ptr (Brazilian Portuguese).
So... Why is that the case?
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6103
|
Posted: 02 March 2021 at 7:56am | IP Logged
|
|
|
Quote:
Ok. So could I leave only olimppi.us there instead of mx1.olimppi.us and mx2.olimppi.us? I think that this A record you mentioned is already there. So I think I don't need to create a new one. |
|
|
I'm saying that you have mx1.olimppi.us MX record but you need that as A record too (CNAME would also work) otherwise mx1.olimppi.us doesn't resolve to any IP.
Quote:
After reading these two tutorials here, I don't know exactly why I'm not receiving emails: https://www.vivaolinux.com.br/topico/Postfix/Erro-554-571-Relay-access-denied-no-Postfix and https://www.hostinger.com.br/tutoriais/o-que-e-um-registro-ptr (Brazilian Portuguese). |
|
|
At the moment, I'm sure it's misconfigured MX standing in the way.
Also, hope you understand that this forum is for Afterlogic products support, you're probably looking for resources which offer assistance with DNS and mailserver setup.
--
Regards,
Igor, Afterlogic Support
|
Back to Top |
|
|
roguitar Newbie
Joined: 07 September 2020 Location: Brazil
Online Status: Offline Posts: 9
|
Posted: 02 March 2021 at 11:29am | IP Logged
|
|
|
Igor wrote:
At the moment, I'm sure it's misconfigured MX standing in the way. |
|
|
Igor wrote:
but what you're definitely going to need is MX record for your domain name - in the simplest case, that will be just one record with the same hostname as domain itself. |
|
|
And you're right. I deleted the latter MX records (mx1.olimppi.us and mx2.olimppi.us) and now I created a new one simply called olimppi.us. And it's working. At least so far...
Look:
https://ibb.co/R3hFKnh
https://ibb.co/vQNLRFx
At 'IMAP and SMTP hosts for external mail clients', which SMTP port do you recommed? 2525 or 587? Thank you.
One last question: is it possible to use credentials from iRedMail or postfix to insert there in PHPMailer?
|
Back to Top |
|
|
roguitar Newbie
Joined: 07 September 2020 Location: Brazil
Online Status: Offline Posts: 9
|
Posted: 02 March 2021 at 2:14pm | IP Logged
|
|
|
roguitar wrote:
Igor wrote:
At the moment, I'm sure it's misconfigured MX standing in the way. |
|
|
Igor wrote:
but what you're definitely going to need is MX record for your domain name - in the simplest case, that will be just one record with the same hostname as domain itself. |
|
|
And you're right. I deleted the latter MX records (mx1.olimppi.us and mx2.olimppi.us) and now I created a new one simply called olimppi.us. And it's working. At least so far...
Look:
https://ibb.co/R3hFKnh
https://ibb.co/vQNLRFx
At 'IMAP and SMTP hosts for external mail clients', which SMTP port do you recommed? 2525 or 587? Thank you.
One last question: is it possible to use credentials from iRedMail or postfix to insert there in PHPMailer? |
|
|
So... Back to square one... Nothing is working now. When I try to send anything, the message shows: "Error while connecting to mail server. (Can't connect to host "tcp://olimppi.us:25")". Why is that the case?
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6103
|
Posted: 02 March 2021 at 3:20pm | IP Logged
|
|
|
Quote:
https://ibb.co/R3hFKnh
https://ibb.co/vQNLRFx |
|
|
That looks good. Though in all fairness, there's not much point in using SSL-enabled connection (port 993 for IMAP, specifically) if your webmail and mailserver are on same machine; 143 for IMAP and 25 for SMTP would work just fine.
Quote:
At 'IMAP and SMTP hosts for external mail clients', which SMTP port do you recommed? 2525 or 587? Thank you. |
|
|
Please see my previous comment, and this setting is actually about hostname, not port. If you run mailserver and webmail at the same host, you can just supply localhost or 127.0.0.1 in WebMail mailserver settings - but if you want to show your users how to connect to your server, you'll need actual mailserver host offered to them, that's what the setting is for. And since you use olimppi.us rather than localhost for IMAP/SMTP, there's no actual need to use that setting.
Quote:
One last question: is it possible to use credentials from iRedMail or postfix to insert there in PHPMailer? |
|
|
I honestly have no idea what you mean and what PHPMailer has to do with anything.
Quote:
So... Back to square one... Nothing is working now. When I try to send anything, the message shows: "Error while connecting to mail server. (Can't connect to host "tcp://olimppi.us:25")". Why is that the case? |
|
|
Your SMTP server probably isn't running. If you're logged onto your server via SSH, run "telnet localhost 25" and see if you get any response. I just did "telnet olimppi.us 25", no response from here either.
--
Regards,
Igor, Afterlogic Support
|
Back to Top |
|
|
roguitar Newbie
Joined: 07 September 2020 Location: Brazil
Online Status: Offline Posts: 9
|
Posted: 02 March 2021 at 3:35pm | IP Logged
|
|
|
Igor wrote:
Your SMTP server probably isn't running. If you're logged onto your server via SSH, run "telnet localhost 25" and see if you get any response. I just did "telnet olimppi.us 25", no response from here either. |
|
|
But it was really working when I was testing it all here in the afternoon. I really don't know why this is happening now. And yes, I ran "telnet olimppi.us 25" and it's not working actually. I did "netstat -plunt" and ports 25 and 587 that previously were working, now are all gone. I don't know if they have been blocked. But I'll try to contact my host company support then.
Igor wrote:
Please see my previous comment, and this setting is actually about hostname, not port. If you run mailserver and webmail at the same host, you can just supply localhost or 127.0.0.1 in WebMail mailserver settings - but if you want to show your users how to connect to your server, you'll need actual mailserver host offered to them, that's what the setting is for. And since you use olimppi.us rather than localhost for IMAP/SMTP, there's no actual need to use that setting.
|
|
|
Thanks. Now I understand. But the issue is that when I didn't leave that part selected, the email external transport (that is, when I sent a message to gmail, for example), it didn't work, only locally. I thought that if I checked that box, external sends would work instead of on location. That's what I thought. And sorry for my bad English.
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6103
|
Posted: 02 March 2021 at 3:41pm | IP Logged
|
|
|
Okay, best of luck sorting it out!
--
Regards,
Igor, Afterlogic Support
|
Back to Top |
|
|
roguitar Newbie
Joined: 07 September 2020 Location: Brazil
Online Status: Offline Posts: 9
|
Posted: 03 March 2021 at 11:34am | IP Logged
|
|
|
Okay, I think I've finally got to solve the issue.
The problem of the ports 25 and 587 not appearing was due to this:
In /etc/postfix/master.cf, I changed those lines:
Code:
-o smtpd_client_restrictions=permit_mynetworks,reject
...
-o smtpd_recipient_restrictions=permit_mynetworks,reject
|
|
|
to this:
Code:
-o smtpd_client_restrictions=
...
-o smtpd_recipient_restrictions=
|
|
|
And then I restarted postfix. After that, connections to ports 25 and 587 showed there again.
And one more thing I've noticed:
Igor wrote:
That looks good. Though in all fairness, there's not much point in using SSL-enabled connection (port 993 for IMAP, specifically) if your webmail and mailserver are on same machine; 143 for IMAP and 25 for SMTP would work just fine. |
|
|
Ok. But I tried 143 for IMAP and 25 for SMTP, and it didn't work. It only works when I try 993 and 587, respectively. Even when I try 993 and 25, it doesn't work. And there is more: I have to leave the 'IMAP and SMTP hosts for external mail clients' checked, in order that emails can come and go. Why is that the case? Because you said that once the mail client (Afterlogic Webmail Lite) is in the same machine as the mail server bundle (iRedMail), there wouldn't be any reason for it not to work.
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6103
|
Posted: 03 March 2021 at 5:45pm | IP Logged
|
|
|
Quote:
But I tried 143 for IMAP and 25 for SMTP, and it didn't work. It only works when I try 993 and 587, respectively. Even when I try 993 and 25, it doesn't work. |
|
|
I would suspect it's something about mailserver configuration. For WebMail itself, it should work just fine. Again, always try with other email clients to see if the mailserver is configured correctly.
Quote:
And there is more: I have to leave the 'IMAP and SMTP hosts for external mail clients' checked, in order that emails can come and go. Why is that the case? |
|
|
That is not possible. Even if those settings applied to how WebMail works with mailserver, which isn't the case (see the last line):
it's still a webmail configuration option. It absolutely does not affect how your mail server sends/receives mail; only Postfix and Dovecot configuration does.
--
Regards,
Igor, Afterlogic Support
|
Back to Top |
|
|
roguitar Newbie
Joined: 07 September 2020 Location: Brazil
Online Status: Offline Posts: 9
|
Posted: 07 March 2021 at 2:03pm | IP Logged
|
|
|
Ok. I think I finally got to set up IMAP port as 143 and SMTP port as 25. And it's working. I'm both sending and receiving messages. But the question is: I know that the default port is 25, but isn't 587 a more secure port? Because you said that 143 and 25 is enough, once that the webmail and the mail server are both in the same machine (which is totally true):
Igor wrote:
Though in all fairness, there's not much point in using SSL-enabled connection (port 993 for IMAP, specifically) if your webmail and mailserver are on same machine; 143 for IMAP and 25 for SMTP would work just fine.
|
|
|
Does that thing you said apply even to sending emails externally? Doesn't this have some influence over how the message will be received on the other end?
Well, this is the screenshot of my mail server settings, using your application. I also left the 'domains' field blank and instead of checking 'Use specified credentials' I checked 'No authentication'. Is that right? Is that safe?
https://ibb.co/gDsw7gc
Thank you
|
Back to Top |
|
|
Igor AfterLogic Support
Joined: 24 June 2008 Location: United States
Online Status: Offline Posts: 6103
|
Posted: 07 March 2021 at 11:27pm | IP Logged
|
|
|
Quote:
I know that the default port is 25, but isn't 587 a more secure port? Because you said that 143 and 25 is enough, once that the webmail and the mail server are both in the same machine (which is totally true) |
|
|
Port 587 can be more secure if it has STARTTLS enabled for it. And some sources suggest using port 587 for client-to-server communication rather than 25. But since we're speaking of communication between email client and mailserver running on the same machine, there's no point using secure port there.
Quote:
Does that thing you said apply even to sending emails externally? Doesn't this have some influence over how the message will be receibed on the other end? |
|
|
No it doesn't, SMTL servers talk to each other on port 25. These settings only apply to how you connect to your mailserver to send/receive mail.
Quote:
this is the screenshot of my mail server settings, using you application. I also left the 'domains' field blank and instead of checking 'Use specified credentials' I checked 'No authentication'. Is that right? Is that safe? |
|
|
Whenever possible, SMTP authentication should be used and should be required for sending mail out. If your server configuration permits sending mail without authentication, it may quickly become a spammers gateway who would send unauthorized emails without you knowing that. Unless of course your server is configured to send mail without authentication from localhost only - that case sounds safe indeed.
--
Regards,
Igor, Afterlogic Support
|
Back to Top |
|
|