iSeries to hMailServer to Office365 via relay...possible?

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
lantran53
New user
New user
Posts: 4
Joined: 2019-07-23 00:21

iSeries to hMailServer to Office365 via relay...possible?

Post by lantran53 » 2019-07-23 01:25

We have an iSeries AS400. We have it configured for SMTP email services through our ISP. Our AS400 sends SMTP messages to that SMTP server unencrypted on port 25, and that SMTP server has a static IP address (which our AS400 requires). All of this our current ISP's SMTP server supports.

However, we are planning on upgrading our internet service and that new internet service only uses Office365 for its SMTP services (in other words, we would no longer be able to use that same ISP's SMTP server).

That means we need to get our AS400 to send SMTP emails via Office365 SMTP services, but Office365 has some problems for our AS400:

1) Office365 only accepts TLS encryption and port 587. Our AS400 does not support those settings (nor am I sure it can).
2) Office365 only provides a FQDN of smtp.office365.com for its SMTP servers. Our AS400 will only send to a specified IPv4 address, NOT a FQDN.

(Background: We tested out putting in one of the IP addresses of the Office365 servers that I found by pinging smtp.office365.com and manually inputting the port number 587 and then also 25 on a separate test, but we never received our test emails that we sent out, nor did we receive any data in Office365 of it having received or even rejected our test emails. They were most likely just rejected out of hand by Office365. I am also aware that Office365 provides its public IPs via a REST function, but we are trying not to build a solution on that yet.)

So, the question: Is it possible to use hMailServer to accept incoming emails from our AS400 on port 25 and then relay those emails to Office365 SMTP servers on port 587 with TLS?

So, if A is the AS400, B is hMailServer (on a Windows 2012 R2 virtual machine), and C is Office365 SMTP servers, the diagram would look like this:

A ---(port 25, no encryption, static IP address)---> B ---(magic hMailServer relay stuff happens and now SMTP is sent out on port 587, TLS, to smtp.office365.com)---> C


I know very little of how SMTP servers are supposed to work, so please bear with me. (Also, does hMailServer have to have a public IP address or will it work with it's DHCP, locally-assigned, 192.168.x.x address? Our network router has the public IP address for our entire LAN, does that mean I would have to somehow register that public IP address with MX records for hMailServer SMTP relays to work? Because I think we might already have that, since we are currently using Office365 for our office email.)

One other odd piece of information...on the same server that I installed hMailServer, I tried sending a SMTP email using PowerShell commands, port 587, TLS and the user credentials for one of our Office365 email accounts...and it worked flawlessly. So I know it can be done somehow.

Thank you!

User avatar
Dravion
Senior user
Senior user
Posts: 1410
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: iSeries to hMailServer to Office365 via relay...possible?

Post by Dravion » 2019-07-23 07:35

First of all, yes it is possible.

But it also depends on exactly why your Office365 Plan looks like.
If you have the cheap, basic Plan, it won't work, because you need mandatory Exchange Online in your Office365 Plan.

Next your need to know, Office365 Servers tending to bitch around what to accept and what not.

However, hMailServer wise, you need to setup correct IP-Settings which sets hMailServer into the mode to accept
incoming Emails from your AS/400 (without login and from all LAN IP's).

Next you need to configure your hMailServer in a way it has EXACTLY the same Domainname as your Office365 Exchange Online
Domainname (nothing else will be accepted by Office365, sorry). On top of this, you need a SSL-Certitificate for your local hMailServer
SMTP-Server enabled. The Trap is, you can't just use any SSL-Certificate, you need to a specific SSL-Certificate which was issued excactly
for your Office365 configured Company Domain.

There is one last thing which can stop the show.
All incoming Relay messages (in your case, the mails from your AS/400) for hMailServer needs to mach a local configured hMailServer account.
hMailServer doesn't require this but the crappy Office365 Server required it or your Email will be rejected.

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

Re: iSeries to hMailServer to Office365 via relay...possible?

Post by jimimaseye » 2019-07-23 08:42

lantran53 wrote:
2019-07-23 01:25
1) Office365 only accepts TLS encryption and port 587. Our AS400 does not support those settings (nor am I sure it can).
2) Office365 only provides a FQDN of smtp.office365.com for its SMTP servers. Our AS400 will only send to a specified IPv4 address, NOT a FQDN.
Im not sure that's true.

Here you go.

https://www-01.ibm.com/support/docview. ... bm10959599
HMS 5.6.6 B2383 on Win Server 2008 R2 Foundation, + 5.6.7-B2415 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

lantran53
New user
New user
Posts: 4
Joined: 2019-07-23 00:21

Re: iSeries to hMailServer to Office365 via relay...possible?

Post by lantran53 » 2019-07-24 00:08

Thank you!

I should say, I am not the main tech for the AS400 and I have only been passing info to you from what they say. They may have overly simplified the situation.

I do know that we looked at that IBM link for getting the AS400 to work with Office365 and our tech team dismissed it as too complicated and time-consuming, but thank you for that.

lantran53
New user
New user
Posts: 4
Joined: 2019-07-23 00:21

Re: iSeries to hMailServer to Office365 via relay...possible?

Post by lantran53 » 2019-07-24 00:10

Also, we use a product called WebSmart and it is also a limiting factor in that our version of it does not allow domain names in the ECFGSMTP settings/command. We would have to upgrade to at least the 11.4 version of WebSmart and our tech team does not want to go that route yet, as they say they would have to recompile many of their written programs.

User avatar
Dravion
Senior user
Senior user
Posts: 1410
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: iSeries to hMailServer to Office365 via relay...possible?

Post by Dravion » 2019-07-24 02:42

lantran53 wrote:
2019-07-24 00:10
Also, we use a product called WebSmart and it is also a limiting factor in that our version of it does not allow domain names in the ECFGSMTP settings/command. We would have to upgrade to at least the 11.4 version of WebSmart and our tech team does not want to go that route yet, as they say they would have to recompile many of their written programs.
In this case you should stick to your Plan with the Windows Server 2012 VM, install hMailServer in it and do as i recommended in my detailed description above.

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

Re: iSeries to hMailServer to Office365 via relay...possible?

Post by jimimaseye » 2019-07-24 08:48

lantran53 wrote:
2019-07-24 00:08
I do know that we looked at that IBM link for getting the AS400 to work with Office365 and our tech team dismissed it as too complicated and time-consuming, but thank you for that.
Wow. Other than the the 'cannot avoid must do' configurations with Office365 (that must be done irrespective of what SMTP server you are using), you only have to do one command to complete the AS400 config:
After the Office 365 configuration steps have been completed using the information above, the "Forwarding Mailhub Server" (FWDHUBSVR) SMTP Attribute will need to be changed to your specific Office 365 domain's MX endpoint host name using the CHGSMTPA FWDHUBSVR(<MX endpoint host>) CL command to complete the set-up process
Doesn't seem so "complicated" or time consuming. (and yet, setting up and VM isnt complicated or time consuming?!)
HMS 5.6.6 B2383 on Win Server 2008 R2 Foundation, + 5.6.7-B2415 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

lantran53
New user
New user
Posts: 4
Joined: 2019-07-23 00:21

Re: iSeries to hMailServer to Office365 via relay...possible?

Post by lantran53 » 2019-07-26 16:11

Thanks to you all very much for your comments and attention. Have been swamped with other items at the moment. Will give your comments and instructions the attention they deserve soon. Thanks again!

User avatar
Dravion
Senior user
Senior user
Posts: 1410
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: iSeries to hMailServer to Office365 via relay...possible?

Post by Dravion » 2019-07-26 16:54

jimimaseye wrote:
2019-07-24 08:48
Wow. Other than the the 'cannot avoid must do' configurations with Office365 (that must be done irrespective of what SMTP server you are using), you only have to do one command to complete the AS400 config:
AS/400 is a different kind of beast. Its a Mainframe system with a total different OS then Windows or Linux, MacOS or UNIX.
Most Companies running a AS/400-System lacking the skills of configuring it. You need some special trained IBM-Experts to get along with it.
You need to recompile a part of the System only for changing a little thing before it can be used.

On the other side, AS/400 are rock solid. They rarely have any down times at all and even if (for example a Power loss) the System stopped
at the last operation state and will resume at the point it went off (including any Software which was running).

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

Re: iSeries to hMailServer to Office365 via relay...possible?

Post by jimimaseye » 2019-07-26 18:37

Dravion wrote:
2019-07-26 16:54
On the other side, AS/400 are rock solid. They rarely have any down times at all and even if (for example a Power loss) the System stopped
at the last operation state and will resume at the point it went off (including any Software which was running).
Yes. I've n been working on AS400 since the model B35 in1989 and still working on them now. The only time we had an unforeseen 'power down' was when a decorator unplugged it to paint around the socket. (True fact. And those that know will be aware that in them days we are talking the huge 100amp industrial connections powering disk cabinets the size of small shed not a desktop kettle lead like they are now).).
HMS 5.6.6 B2383 on Win Server 2008 R2 Foundation, + 5.6.7-B2415 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

User avatar
Dravion
Senior user
Senior user
Posts: 1410
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: iSeries to hMailServer to Office365 via relay...possible?

Post by Dravion » 2019-07-26 19:48

Yeah, good Devices but horrible in terms of Programming. I had a short time contract working with ILE RPG and SEU and CL. It was like as working with Punch cards. But thepay was good ;-)

Post Reply