Home‎ > ‎

Setup internal SMTP relay server to user Google mail server

Setup an internal relay outbound email for those legacy network devices to use Google Apps mail server.

Google's mail servers use TLS (SSL) encryption that require authentication for sending email.  

Many legacy network devices, such as copier/scanner/multi function devices, do not support authenticated SSL login to a SMTP server.  The following solution is a simple, low impact solution.  By using the open source hMailServer to act as a Windows-based SMTP relay, companies can successfully switch to Google Apps without losing the ability to scan and email documents directly from their multi-function devices.

System requirement:
  1. A valid Google Apps account (batter to have a dedicated application user account, instate of normal user account).
  2. A PC or server which run windows server 2003 or above.
  3. Internet connection for the PC or server to connect to Google mail server (smtp.gmail.com) via port 465 or port 587.
  1. Download hMailServer from http://www.hmailserver.com/
  2. Select a machine that will be on and accessible 24/7 from any necessary device on the network.
  3. Perform a standard install.  Drive space should be minimal as this system will act strictly as a relay server, and only cache undeliverable messages.
  4. Set an admin password for the console and be sure not to lose it as this admin panel will be accessed very infrequently after successful deployment.
  5. Configure a GMail/Google Apps account for outbound use.  Skip to step 6 if you have already done this, otherwise, for Google Apps:
    1. Login to your Google Apps control panel as an administrator (typically https://www.google.com/a/yourdomain.com).
    2. Create a dedicated account for outbound scans/reports/etc, such as scans@yourdomain.com and Save.
    3. * Important * Login to your new account through the Google Apps interface for your domain, as if you were a new user, and perform the CAPTCHA verification and accept the terms for the account and test the inbox functionality.
    4. Logout and note these credentials for the next steps. 
  6. Open the Administration console for hMailServer and make the following configuration changes in hMailServer:
    1. [Domains | Add...] Add a new local domain.  For example, local.yourdomain.com and Save.
    2. [Domains | local.yourdomain.com | Accounts | Add...] Add a new local account.  For example,scans@local.yourdomain.com and Save.
    3. [Settings | Protocols | SMTP | Delivery of e-mail] make the following changes:
      1. [Local host name] = yourserver.yourdomain.com (pretty much irrelevant)
      2. [Remote host name] = smtp.gmail.com
      3. [Remote TCP/IP port] = 465
      4. [Server requires authentication] = Checked
      5. [User name] = scans@yourdomain.com (or yourdomainscans@gmail.com, etc.)
      6. [Password] = <as chosen>
      7. [Use SSL] = Checked
      8. <SAVE>
    4. [Settings | Advanced | IP Ranges] Add...
      1. [Name] = Firewalled subnets
      2. [Priority] = 20
      3. [Lower IP] - [Upper IP] = Inclusive local subnet that includes network devices that need to relay.
      4. [Other]
        1. [Anti-Spam] = Cleared
        2. [Anti-Virus] = Cleared
      5. [Require SMTP Authentication]
        1. [Local to local e-mail addresses] = Cleared
        2. [Local to external e-mail addresses] = Cleared
        3. [External to local e-mail addresses] = Cleared
        4. [External to external e-mail addresses] = Cleared
      6. <SAVE>
    5. <EXIT>
  7. Open the configuration page for your multi-function device or automated system that needs to relay.
  8. Select the IP address (or resolvable host name) of the computer on which you installed hMailServer as the mail server.
  9. If necessary set the username as scans@yourdomain.com and the password <as chosen>.
  10. It is not required to set a username and password if the device does not support it.
  11. Send a test e-mail to an external address and verify receipt.

If you're having problems getting the relay to work, here are some things to try:

  1. Configure a standard mail client with the local (scans@local.yourdomain.com) address and password, and point it at the hMailServer.
  2. Send a message to an external address and check the non delivery report.
  3. Open the Administration console and enable logging as follows:
    1. [Settings | Logging | Enabled] = Checked
    2. [Log | Application] = Checked
    3. [Log | SMTP] = Checked
    4. [Log | TCP/IP] = Checked
  4. <Show Logs>
  5. Send a test e-mail and check the logs.  Typical errors include incorrect credentials, or a mistyped port on the outbound relay page. 

  This is a VERY INSECURE installation if the internal SMTP relay server is not behind your office firewall. If possible, please only allow the IP address of those systems that require the SMTP relay at the hMailserver setting (refer to the step 6 above). Do not open up the access list to the entire IP ranges of your office private network, Keep in mind that, those user's PCs/Laptops that affected by malware that looks for open relays on you local network will be able to forward with impunity through this relay.