osTicket email using Gmail and Google Apps SMTP relay

osTicket and Google SMTP

If you’re not familiar with osTicket, it’s a fantastic, open source support ticket tracking system written in PHP. I’ve tried out a number of free ticketing systems over the past few months, and osTicket has been the only one to really impress me. It offers a wide variety of features but still manages to be quick and easy to install.

osTicket Email using Google SMTP Settings

Just recently, I installed osTicket 1.8 at work where we use Google Apps for Business. To send and receive mail through our domain hosted with Google Apps, a new user had to be added through the admin console. A regular Gmail account will work just as well if you don’t need your own domain. Either way, you’ll want to enable POP access in the user’s Gmail settings.

Gmail POP Settings for osTicket
In addition to just enabling POP, it’s a good idea to have Gmail archive messages after they’ve been downloaded. This way you’ll have the original messages handy in case there’s a problem with the ticket or an attachment is rejected due to an unapproved file type.

The actual settings you need to configure the email account in osTicket are somewhat buried in the Gmail help. Selecting, I want to enable POP and then Other will get you to them.

Here’s what worked for me:

Email Address: Full email address
Username: Full email address
Mail Host: pop.gmail.com
Mail Port: 995
Encryption: SSL
SMTP Host: smtp.gmail.com
Port: 587
Authentication Required: Yes

With this, I was able to send and receive messages with my designated email address easily. Even if you modify Email Address and Allow email header spoofing messages sent from osTicket will still be sent as the authenticated user. If you want to send and receive with different addresses, you’ll have to create those users separately.

osTicket Email using Google Apps SMTP Relay Service

If you’re a Google Apps customer you have more flexibility. By adding aliases to the previously created user, you can receive mail sent to any number of addresses without the need to pay for additional users.

Sending with different addresses is where things get interesting. Google Apps customers have access to a SMTP relay service which allows you to relay messages using any domain associated with your account without authenticating. There’s some minor setup involved, mostly designating the IP address or range you’re authorizing for your domains.

There are just a few settings necessary to configure an email address being relayed:

Email Address: Full email address
SMTP Host: smtp-relay.gmail.com
SMTP Port: 465
Authentication Required?: No
Allow Header Spoofing?: Yes

That’s it! With this, osTicket can send as any address on your Google Apps domains by just changing the specified Email Address. This works well as long as the address you’re sending as does not already exist.

When I attempted to have osTicket relay using an existing address, the browser would spin for approximately thirty seconds before displaying a confirmation message. While the email would be sent, that sort of delay would drive users crazy.

There’s an easy solution to this! Just go into the Gmail settings for the user you initially set up. On the Accounts there’s a link to Add another email address you own.

Add Gmail address for osTicket

Enter the address you’d like to send as and continue. When you confirm your request a verification code will be emailed to the account you’re linking. Enter the code or click the link to confirm your ownership and enable sending as that email address.

With sending enabled, this address can be added very much like the first one without the special relay server:

Email Address: Full email address you just linked
Username: Full email address of mail user
Mail Host: pop.gmail.com
Mail Port: 995
Encryption: SSL
SMTP Host: smtp.gmail.com
Port: 587
Authentication Required: Yes

With these changes, mail sent by this address will appear to be from the Email Address specified at the top.


If you have questions about osTicket email configuration, post a comment below.

8 responses to “osTicket email using Gmail and Google Apps SMTP relay”

  1. Hello James Bradach
    I get the following error “Can’t connect to gmail-pop.l.google.com,995: Connection timed out” by having the above said POP settings, FYI i am using google Apps. please help me to getting it connected.
    Thanks in advance.

    • My guess is that your server is trying to connect using IPv6 which doesn’t seem to work for pop.gmail.com or smtp.gmail.com at this time. Linux prefers IPv6 if both IPv4 and IPv6 results are returned.

      Try checking from the command line with telnet or something similar. You can append -6 or -4 to force your address preference.

      Forcing IPv6:
      telnet pop.gmail.com 995 -6
      Trying 2607:f8b0:4002:c03::6d...

      Forcing IPv4:
      telnet pop.gmail.com 995 -4
      Connected to gmail-pop.l.google.com.
      Escape character is '^]'.

      If IPv4 works, you may want to disable IPv6 for now or modify your application’s code to force IPv4.

  2. Hi James,

    really nice articel. I try to use our gmail Address via a POP Account in our osticket installation. Other providers works fine – but not gMail. Our osticket is running as a https:// page with certificate.

    Everytime I try to save the new settings – it need arround 45s and then this error is displayed.

    Can’t connect to gmail-pop.l.google.com,995: Network is unreachable

    Do you have a idea what goes wrong. I´ve done it like your wrote it here – hope you can help me. Google isn´t able to help us. (It´s also a gmail bussiness Apps Account).

    Email Address: Full email address
    Username: Full email address
    Mail Host: pop.gmail.com
    Mail Port: 995
    Encryption: SSL
    SMTP Host: smtp.gmail.com
    Port: 587
    Authentication Required: Yes

  3. I checked maps server. There is only IPv4 active but no IPv6. The Firewall Ports 995 is open also. I have absolutely no idea what causes the trouble.

    Can you help me with this? It’s a nightmare for me.

  4. Hi James.. nice article
    I’ve got a problem in which perhaps you can help me
    I keep on getting this message Failed to connect to ssl://smtp.googlemail.com:465 [SMTP: Invalid response code received from server (code: -1, response: )]

    I can fix that by simply accessing https://accounts.google.com/DisplayUnlockCaptcha and login to the gmail account I used, but the problem keeps on occurring. Any idea?


  5. Hello all, I was using osticket with my exchange server as SMTP.
    All of sudden emails stops working, i tried to reset password, used zoho smtp,gmail smtp ,but all in vain.then i moved it to a shared hosting panel and used default php mailer. Its working fine,but still struggling for mails through externals smtp. The best thing on another application same smtp credtional are working.
    Experts advise are required

Leave a Reply

Your email address will not be published. Required fields are marked *