Help setting up SMTP server

Use this forum if you have installed hMailServer and want to ask a question related to a production release of hMailServer. Before posting, please read the troubleshooting guide. A large part of all reported issues are already described in detail here.
Post Reply
megaforce1020
New user
New user
Posts: 11
Joined: 2015-02-05 19:11

Help setting up SMTP server

Post by megaforce1020 » 2015-02-05 19:28

Hi, let me explain what I am trying to do. I have a Sharp networked printer/scanner/copier. What I'd like to do is be able to send scanned images from the sharp machine to an email inbox. In order to do that I needed a smtp server so I decided to build one locally on the same network as the sharp machine. So I decided on hMailServer. I've gone through the installation process pretty easily and straightforward till now. The two obstacles that I have run into now is testing the server and the WebAdmin. My question is in the configuration tutorial, it says to see if port 25 is blocked try telnet to mail.hmailserver.com 25. When I try I am unable to get that to work. Is that the right address? Or does it need to be mail.<whatever domain I specified> 25?

My second question is about WebAdmin. Is this thing required for hmailserver to work? If not I'd rather not have to go through the trouble of getting it up and running as I am fine doing everything in the Admin console.

Thanks for you guys help!

User avatar
jimimaseye
Moderator
Moderator
Posts: 8680
Joined: 2011-09-08 17:48

Re: Help setting up SMTP server

Post by jimimaseye » 2015-02-05 19:44

If your hmailserver is on the same network as your scanner, and the user accounts that are receiving the emails are on hmailserver then external access via port 25 on the ADSL line is not necessary (just as long as it is open on all internal ports of the scanner and the server). However, if you are planning to send or receive emails to/from external addresses with hmailserver then it will be necessary.

Webadmin: absolutely not necessary. Only useful if you want it and have IIS (or similar webserver) setup. But if you are happy with HmailAdmin program (as I am and many others) then use it.
5.7 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

megaforce1020
New user
New user
Posts: 11
Joined: 2015-02-05 19:11

Re: Help setting up SMTP server

Post by megaforce1020 » 2015-02-05 19:59

Thanks for your help. So if email accounts are on the same network then I won't have to ever worry about that smtp relayer configurations then correct? Just to make sure?

percepts
Senior user
Senior user
Posts: 5282
Joined: 2009-10-20 16:33
Location: Sceptred Isle

Re: Help setting up SMTP server

Post by percepts » 2015-02-05 20:15

You don't ever need relay setup unless for a very specific reason such as ISP blocking outboud ports.

Now, are you saying you don't want to send or receive email to/from external addresses and that you will use hmail for internal (inside your lan) use only ?

If so then see following: https://www.hmailserver.com/documentati ... t_up_local

megaforce1020
New user
New user
Posts: 11
Joined: 2015-02-05 19:11

Re: Help setting up SMTP server

Post by megaforce1020 » 2015-02-05 20:23

AH! You guys are the bomb! This is exactly what I need. I totally missed this when looking through the documentation. Yes I have no desire to use this to receive or send email externally. This will work great! Thank you, thank you!

megaforce1020
New user
New user
Posts: 11
Joined: 2015-02-05 19:11

Re: Help setting up SMTP server

Post by megaforce1020 » 2015-02-06 04:59

So I am running into some problems. Typically if I were to setup the smtp server via gmail on the scanner, the primary server field I would type in smtp.gmail.com, but now I have no idea what I should put in this field. Should this be local host name that I've entered in the delivery of e-mail section inside SMTP?

User avatar
Lee Thompson
Normal user
Normal user
Posts: 36
Joined: 2009-01-15 11:18

Re: Help setting up SMTP server

Post by Lee Thompson » 2015-02-06 05:32

In the scanner's configuration, what will work best is your LAN IP address of the machine running hmail.

megaforce1020
New user
New user
Posts: 11
Joined: 2015-02-05 19:11

Re: Help setting up SMTP server

Post by megaforce1020 » 2015-02-06 05:43

okay, then using that IP address of the machine that hMailServer is on, when I send a email hMailServer should pick up that email and forward it to the email inbox I need the scanned imaged to correct?

I have couple of people in my department; we will call them matt, john, and fred. They each have a email tied to our company domain say health.com. So it would be fred@health.com or john@health.com. When I scan an image and send that image to fred@health.com, hmailserver should pick that image up and forward it to the email storage of fred@health.com right as long I have an account setup under domain in hmailserver?

User avatar
Lee Thompson
Normal user
Normal user
Posts: 36
Joined: 2009-01-15 11:18

Re: Help setting up SMTP server

Post by Lee Thompson » 2015-02-06 06:52

megaforce1020 wrote:okay, then using that IP address of the machine that hMailServer is on, when I send a email hMailServer should pick up that email and forward it to the email inbox I need the scanned imaged to correct?

I have couple of people in my department; we will call them matt, john, and fred. They each have a email tied to our company domain say health.com. So it would be fred@health.com or john@health.com. When I scan an image and send that image to fred@health.com, hmailserver should pick that image up and forward it to the email storage of fred@health.com right as long I have an account setup under domain in hmailserver?
I don't know the specifics of your particular scanner but I've set this up in my own company. Some scanners send to a particular address each time, others let you make an address book.

I am assuming the hMailServer running on your LAN is solely for the scanner's use and your actual e-mail is handled somewhere else (the @health.com in your example). If this is the case, you actually shouldn't need to set up any accounts (other than the default ones) on hMailServer at all.

  • The scanner should be sending SMTP to the computer where hMailServer is installed and running using it's internal/LAN IP address.
  • Your hMailServer installation should be set up to basically relay either directly or as a smarthost. It should not think it's setup to handle mail for your domain (i.e. @health.com).
  • The scanner (depending on it's abilities) should be set up to send the scans to a static e-mail address or have it's own address book. The actual addresses should be the actual e-mail address(es) of the intended users. (It's possible, although less desirable, to set up forwarding accounts in the local hMailServer but really it's just more things to break).

There are a few potential gotchas/things to look for.
  • Your internal hMailServer needs to be set up to relay, it should really just do this for the internal IP range. In your case, port 25 TCP inbound should not be going to your server so it could be wide open.
  • Some ISPs block port 25 outbound to combat spam/force use of their mail services. Hopefully this isn't the case in your setup. (If it is, you may need to contact them for an exception.) (If you can telnet to mail.hmailserver.com 25 and see a banner, you're golden.)
  • If your hMailServer is sending directly and not using a 'smarthost' of it's own, you will want to ensure that the reverse DNS (PTR) record and address records match or you may end up with issues. (If you control your company's mail server directly you can skip this and set up exceptions to various rules if you need to.)
  • Another potential gotcha with scans in particular is if the scan is large it may get rejected by the receipient's mail server. Sometimes this limit is as low as 5MB so you may want to make sure you're having the scanner compress the image nicely. (If, during testing, some scans make it and some don't, this is a probable cause.)
  • If you can, make sure the sending/reply address from the scanner is to a mailbox you can access so you can monitor it for errors. Especially early on.

megaforce1020
New user
New user
Posts: 11
Joined: 2015-02-05 19:11

Re: Help setting up SMTP server

Post by megaforce1020 » 2015-02-06 06:57

Do I need to utilize TCP outbound port 25 if the emails are all local to outlook clients setup on our internal network?

megaforce1020
New user
New user
Posts: 11
Joined: 2015-02-05 19:11

Re: Help setting up SMTP server

Post by megaforce1020 » 2015-02-06 07:00

O and our scanner is a sharp mx2300n

User avatar
Lee Thompson
Normal user
Normal user
Posts: 36
Joined: 2009-01-15 11:18

Re: Help setting up SMTP server

Post by Lee Thompson » 2015-02-06 07:36

If it's all going to be local only, it's a lot simpler.
  • You don't need to worry about port 25 inbound/outbound outside of your LAN at all.
  • You will need to create accounts in hMailServer
  • hMailServer will need to be configured for your local e-mail domain.
  • No need to worry about DNS records.
  • No need to worry about message size (unless you set one in hMailServer itself).
  • No need to worry about SMTP authentication or SSL.
If you are going to have people checking their 'scan e-mail' box from outside your LAN, you will need to accept connections for one or both mail retrieval protocols from the WAN (Internet) connection. (These are the POP3 and/or IMAP protocols. TCP 110 and 143 respectively, 995 and 993 with SSL.) If this is the case, I would strongly recommend using IMAP (preferably SSL only) and use strong passwords for each account. (Hackers probe for mailbox accounts all the time.) (If everything is LAN/local only, ignore this entire paragraph.)

I looked up the manual for your scanner and it does have an address book.
(It also seems to have a scan to network folder function which might be simpler for you than e-mail, depending on your needs/setup.)

megaforce1020
New user
New user
Posts: 11
Joined: 2015-02-05 19:11

Re: Help setting up SMTP server

Post by megaforce1020 » 2015-02-06 07:40

Ha yeah, I got really confused trying to setup this because it is very simple once you know what to do, but for someone who has never done anything like this before its very confusing cause most people are doing more complex tasks with SMTP servers. Thanks alot for all your help Lee. I greatly appreciate it

User avatar
mattg
Moderator
Moderator
Posts: 20970
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Help setting up SMTP server

Post by mattg » 2015-02-06 09:22

megaforce1020 wrote:Do I need to utilize TCP outbound port 25 if the emails are all local to outlook clients setup on our internal network?
Doesn't matter where the Outlook clients are

DOES MATTER where the mail server is....

You are probably best to set up a route in hmailserver to point to the location of where your regular mailserver is. IP address is fine, and if it is external to your LAN, you may need to use port 587, and set the regular mail server to listen on that port
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

User avatar
jimimaseye
Moderator
Moderator
Posts: 8680
Joined: 2011-09-08 17:48

Re: Help setting up SMTP server

Post by jimimaseye » 2015-02-06 10:39

Just a thought from me....

I dont understand. Why cant the scanner simply be set to point at 'health.com' as the smtp server (instead of [hmaliserver address])? Does it not accept FQDN as a server address? Even so, isnt the health.com mx address static (and simply enter that)? Or isnt the health.com mailserver INSIDE your network anyway? Have you actually tried this? (You might be surprised to find all ports are open anyway)

At the start of all this you said you need to specify an SMTP server for your scanner to send emails too, and that is why you installed hmailserver. Well, surely (probably) your outlook MAILSERVER (holding and providing all regular mails for health.com) IS an SMTP server. So just point to that?!

I would test all this out first before tackling problems that dont exist. (2nd mailservers, forwarding, relaying, port opening etc)
5.7 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

megaforce1020
New user
New user
Posts: 11
Joined: 2015-02-05 19:11

Re: Help setting up SMTP server

Post by megaforce1020 » 2015-02-06 18:10

I will definitely look into your idea jimimaseye. Thanks for the insight/advice!

User avatar
mattg
Moderator
Moderator
Posts: 20970
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Help setting up SMTP server

Post by mattg » 2015-02-07 04:58

From my experience, sometimes the devices can't specify port numbers

If the existing mailserver is external to the LAN AND port 25 outgoing is blocked, then you need something in the middle to change the ports (hmailserver does this with SMTP relayer function)

Rarely, you can't specify username in the form 'account@domain.com', in which case hmailserver can get around this by setting a default domain.

MOST DEVICES can use Google SMTP servers on port 587 using StartTLS (and therefore any SMTP server) and no other software (including hMailserver) is needed
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

User avatar
Lee Thompson
Normal user
Normal user
Posts: 36
Joined: 2009-01-15 11:18

Re: Help setting up SMTP server

Post by Lee Thompson » 2015-02-08 04:10

jimimaseye wrote:Just a thought from me....

I dont understand. Why cant the scanner simply be set to point at 'health.com' as the smtp server (instead of [hmaliserver address])?
I was avoiding names since I didn't know if the scanner would be setup to use DNS lookups or not and was just trying to keep it simple.

User avatar
jimimaseye
Moderator
Moderator
Posts: 8680
Joined: 2011-09-08 17:48

Re: Help setting up SMTP server

Post by jimimaseye » 2015-02-08 11:30

Indeed. But it is highly likely that the mail server will be on a static address (whether it is internal or external). So even it is at the end of a FQDN, (something like 'mail.health.com', you only have to resolve it yourself once and enter the ip address (so the scanner wont need to be arsed about dns lookups etc). If its external, evaluate the MX record and find the ip address.
5.7 on test.
SpamassassinForWindows 3.4.0 spamd service
AV: Clamwin + Clamd service + sanesecurity defs : https://www.hmailserver.com/forum/viewtopic.php?f=21&t=26829

megaforce1020
New user
New user
Posts: 11
Joined: 2015-02-05 19:11

Re: Help setting up SMTP server

Post by megaforce1020 » 2015-02-12 01:44

hey so this is the problems I am running into when configuring my printer:

"SMTPD" 4832 30 "2015-02-11 16:16:44.870" "192.168.0.251" "SENT: 220 192.168.0.15 ESMTP"
"SMTPD" 7364 30 "2015-02-11 16:16:44.870" "192.168.0.251" "RECEIVED: EHLO SCD99C36"
"SMTPD" 7364 30 "2015-02-11 16:16:44.886" "192.168.0.251" "SENT: 250-192.168.0.15[nl]250-SIZE 20480000[nl]250 AUTH LOGIN"
"SMTPD" 4832 30 "2015-02-11 16:16:44.886" "192.168.0.251" "RECEIVED: MAIL FROM:<matt@health.com>"
"SMTPD" 4832 30 "2015-02-11 16:16:44.902" "192.168.0.251" "SENT: 250 OK"
"SMTPD" 7364 30 "2015-02-11 16:16:44.902" "192.168.0.251" "RECEIVED: RCPT TO:<admin@health.com>"
"SMTPD" 7364 30 "2015-02-11 16:16:44.902" "192.168.0.251" "SENT: 530 SMTP authentication is required."

I believe this is the entire process. The email I am trying to send an image to is to admin@health.com
Also I wanted to include the diagnostics of hmailserver. Hopefully you guys can help me make more sense of it. Also of note this is all just on local network, I think and health.com is made up. Thanks for help in advance!

Test: Collect server details
hMailServer version: hMailServer 5.6-B2145
Database type: MSSQL Compact

Test: Test IPv6
IPv6 support is available in operating system.

Test: Test outbound port
SMTP relayer not in use. Attempting mail.hmailserver.com:25...
Trying to connect to host mail.hmailserver.com...
Trying to connect to TCP/IP address 46.163.109.39 on port 25.
ERROR: It was not possible to connect.

Test: Test backup directory
ERROR: Backup directory has not been specified.

Test: Test MX records
Trying to resolve MX records for health.com...
Host name found: health-com.mail.protection.outlook.com

Test: Test local connect
Connecting to TCP/IP address in MX records for local domain domain health-com...
Trying to connect to host health-com.mail.protection.outlook.com...
Trying to connect to TCP/IP address 207.46.163.247 on port 25.
Trying to connect to TCP/IP address 207.46.163.215 on port 25.
Trying to connect to TCP/IP address 207.46.163.170 on port 25.
ERROR: It was not possible to connect.
ERROR: Was not able to open connection.

Test: Test message file locations
Relative message paths are stored in the database for all messages.

Test: Test IP range configuration
No problems were found in the IP range configuration.

User avatar
mattg
Moderator
Moderator
Posts: 20970
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Help setting up SMTP server

Post by mattg » 2015-02-12 01:52

OK

1. Create a new IP range for that device 192.168.0.251 >> 192.168.0.251 Give it a priority higher than any others present, say 30
Allow local to local without Authentication

2. Create a route to your hosted domain 'health.com'. You may need to authenticate with a username and password for the external server to accept mail
Treat as local domain when sending to this route

Try again
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

megaforce1020
New user
New user
Posts: 11
Joined: 2015-02-05 19:11

Re: Help setting up SMTP server

Post by megaforce1020 » 2015-02-12 06:02

Thanks for the reply mattg. The authentication should be the one that is used to secure the external server right? Should I worry about any ports or firewall rules? Also the local host name and the domain that I created in hmailserver is health.com not health-com.mail.protection.outlook.com. Does this matter?

User avatar
mattg
Moderator
Moderator
Posts: 20970
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Help setting up SMTP server

Post by mattg » 2015-02-12 07:47

windows firewall port 25 should be open for LAN traffic (It is at the moment, because the device connects to the hmailserver and is rejected. If the port wasn't open no connection attempt would occur. Firewall may be off for same result)

Yes in the route, use authentication for an account on the remote server. Probably just your username and password like is used in Outlook would be fine.

Local host name and local domain matters little, except that the remote server MAY reject mail if it is a totally bogus name. Using Health.com should be safe
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

Post Reply