Can't get Hesk to work with Office 365 SMTP, IMAP, POP

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
Superaj
Posts: 4
Joined: Sun Oct 01, 2017 1:43 am

Can't get Hesk to work with Office 365 SMTP, IMAP, POP

Post by Superaj »

Version of script: 2.7.3
Hosting company: Bluehost
What terms did you try when SEARCHING for a solution: "Office 365", "office 365 smtp"

Write your message below:

Has anyone had luck getting Office 365 email server settings for SMTP and POP/IMAP Fetching to work with Hesk? I've tried all combinations and either get connection timeouts, or connection refused. Since I don't see a lot of people asking about Office 365 problems with Hesk, and given how common O365 is becoming, I'm guessing there is just something wrong with my configuration. Any help or feedback is appreciated!

Here's what I've tried so far:

SMTP Email settings:

1 - Using O365 SMTP server settings with the TLS option (smtp.office365.com, TLS, port 587, user@domain.com/password for user). Results in Hesk error "Error: Could not connect to the host "smtp.office365.com": Connection timed out"

2 - Using O365 SMTP server settings with SSL instead of TLS (smtp.office365.com, SSL, port 465, user@domain.com/password for user). Results in Hesk error "Error: Could not connect to the host "smtp.office365.com": Connection timed out"

3 - Configuring a connector using these instructions:
https://support.office.com/en-us/articl ... 05d654b4c4.
Results in Hesk error "Connection Refused"

POP Fetching:

Timeout: 15 min
Host: outlook.office365.com
Port: 995
TLS: on
Username/pass: user@domain.com/password for user
Results in Hesk error Connection timed out.

IMAP Fetching:

Host: outlook.office365.com
Port: 587
TLS: on
Username/pass: user@domain.com/password for user

Any setting I use just gets Hesk stuck on "Testing connection, this can take a while..." which causes the browser/tab to hang. I then can't reload the Hesk site at all for 5-10 min.
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Can't get Hesk to work with Office 365 SMTP, IMAP, POP

Post by Klemen »

These settings should work fine for SMTP for example:

SMTP Host: smtp.office365.com
SMTP Port: 587
SMTP Timeout: 15
SSL Protocol: OFF
TLS Protocol: ON
SMTP Username: (your email username)
SMTP Password: (your email password)

The "Connection timed out" error means Hesk was unable to even connect to the SMTP server. You will need to open IN and OUT connections to port 587 in the server firewall where Hesk is installed at.

You can confirm the firewall is the issue by trying to connect to any other third part SMTP server on port 587 - you will get the same error, its not limited to office365.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Superaj
Posts: 4
Joined: Sun Oct 01, 2017 1:43 am

Re: Can't get Hesk to work with Office 365 SMTP, IMAP, POP

Post by Superaj »

Thank you for the reply. After hours of researching and talking to bluehost support, it looks like they block the ports needed for smtp/pop/imap on their hosting servers. Even with a dedicated IP or VPS, they won't allow you to manage/open ports below 1024. Previously when our email was hosted/managed by Bluehost, we could use PHP() email sending, and email piping to receive emails back. However now with Office 365 and needing to connect through ports 587 for SMTP, 993 for IMAP and 995 for POP not being allowed by BH, it no longer works.

This is a real show stopper for us. Now we have to choose between a functioning Hesk install on our server which we have come to enjoy and depend on very much, and moving our email to Office 365 and moving away from Hesk.

Any other ideas or options are appreciated.
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Can't get Hesk to work with Office 365 SMTP, IMAP, POP

Post by Klemen »

I though this is the case, yes. Unfortunately it will not be possible to integrate with Office365 on Bluehost due to their firewall policies.

Note that this isn't limited to Hesk; no software will be able to connect to Office365 from their server.

Solution? Move to a server that has the required ports open (or gives you control over them). Or consider the Hesk cloud, Office365 will work from it.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Superaj
Posts: 4
Joined: Sun Oct 01, 2017 1:43 am

Re: Can't get Hesk to work with Office 365 SMTP, IMAP, POP

Post by Superaj »

How would we move our existing DB/users/settings to the Hesk cloud?
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Can't get Hesk to work with Office 365 SMTP, IMAP, POP

Post by Klemen »

I can arrange that, please contact me here with this info:

1. your HESK version:
2. approximate number of tickets (total):
3. approximate number of new ticket per month:
4. approximate size of your "attachments" folder
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
PeteHanley
Posts: 5
Joined: Wed Oct 04, 2017 2:39 pm

Re: Can't get Hesk to work with Office 365 SMTP, IMAP, POP

Post by PeteHanley »

Upgraded Hesk from 2.6.7 to 2.7.5. Upgraded Mods for HESK from 2.6.3 to 3.2.4
Using PHP 5.6.25 and MySQL 5.5.58-cll

I cannot seem to connect SMTP, POP or IMAP but I have confirmed that user name and password are correct.

SMTP Port: 465 SSL: Off TLS: Off Result: Error: It was not possible to read line from the SMTP server: data access time out
SMTP Port: 465 SSL: On TLS: Off Result Error: Could not connect to the host "smtp.office365.com":
SMTP Port: 587 SSL: Off TLS: On Result: Error: Could not start TLS connection encryption protocol
SMTP Port: 587 SSL: Off TLS: Off Result: Error: 535 Incorrect authentication data
SMTP Port: 587 SSL: On TLS: On or Off Result: Error: Could not connect to the host "smtp.office365.com":
SMTP Port: 25 SSL: Off TLS: Off Result: Error: 535 Incorrect authentication data

POP Fetching Port: 995 TLS: On Result: Error: Password error: Logon failure: unknown user name or bad password.
POP Fetching Port: 995 TLS: Off Result: Error: Error: 3 POP3 server greeting was not found

IMAP Fetching Port: 993 Encryption: SSL Result: Error: Can not authenticate to IMAP server: AUTHENTICATE failed.
IMAP Fetching Port: 993 Encryption: TLS Result: Error: [CLOSED] IMAP connection broken (server response)
IMAP Fetching Port: 993 Encryption: None Result: Error: [CLOSED] IMAP connection broken (server response)
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Re: Can't get Hesk to work with Office 365 SMTP, IMAP, POP

Post by Klemen »

PeteHanley wrote: Sat Dec 02, 2017 8:34 am Result: Error: 535 Incorrect authentication data
...
Password error: Logon failure: unknown user name or bad password.
...
Can not authenticate to IMAP server: AUTHENTICATE failed.
These were successful connections to the Office 365 server, but the server rejected your credentials.

If double-checking username/password doesn't help (check password case, correct username, ...) then it could be a security setting in O365 blocking connections from unknown IPs? I don't have O365 myself to be sure or to be able to guide you to the correct setting.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Superaj
Posts: 4
Joined: Sun Oct 01, 2017 1:43 am

Re: Can't get Hesk to work with Office 365 SMTP, IMAP, POP

Post by Superaj »

We were able to resolve this eventually so I wanted to update this thread in case anyone in the future had the same issue.

The problem was with our hosting server blocking those ports. We contacted bluehost many many times and each time they swore they weren't blocking Email ports. I finally pushed them to escalate and provided screenshots showing commands connecting to the IMAP servers working on my local PC and those same commands not working on our Bluehost website host. They finally escalated it and confirmed it was being blocked. After they fixed the block, all was working well.

Hope this helps someone in the future.
Post Reply