hMailServer with Exchange 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.
avdreith
New user
New user
Posts: 6
Joined: 2008-10-03 16:54
Location: Germany

hMailServer with Exchange Server

Postby avdreith » 2012-07-11 16:18

hi! I've got a question!

I'm downloading pop3 accounts and forward them to an exchange server. This works! All mail has the same domain (example.com). the downloaded mails are forwarded to the exchanger server which has the same domain (example.com). So far no problems.

Otherwise i would also like to send mails out using hmailserver. This means exchange sends the mail using smtp to hmailserver and hmailserver forwards it to my provider. This also works - in most cases.
In my case some mailadresses of the domain are not located on the exchangeserver but are beeing used independently with external clients like thunderbird (pop3 download). So if an internal user (internal@example.com) sends an mail to an an external user (external@example.com) hmailserver tries to deliver the mail back to exchange and doesn't relay it to my provider - due to the smtp-route (example.com) in hms.

I tested with "Deliver to adresses below" in my smtp route. But this only produced an undeliverable message. I also tried different ip range settings. Nothing reale worked.

Is this problem resolvable at all?

User avatar
BOOZy
Normal user
Normal user
Posts: 76
Joined: 2006-05-25 01:25
Location: .nl
Contact:

Re: hMailServer with Exchange Server

Postby BOOZy » 2012-07-11 17:41

If you're only using the hmailserver as a glorified POP connector you could have sufficed with a dummy domain to collect the external pop accounts, that way there's no collision with the domain on the Exchange server.

If there's a combination of Exchange accounts and POP accounts on the hmailserver, don't forget to 1) create a route on the hmailserver, and 2) set the domain as 'External Relay' under 'Accepted Domains' in'Hub Transport'

avdreith
New user
New user
Posts: 6
Joined: 2008-10-03 16:54
Location: Germany

Re: hMailServer with Exchange Server

Postby avdreith » 2012-07-12 08:01

hm.... sorry but i'm not sure what you mean.

On hms the accounts that download mails from pop3 have a dummy domain like you mentioned (example.int). So mails from pop3 (example.com) are downloaded by the dummy domain accounts (example.int) on hms and are forwarded to exchange via the smtp route "example.com". under hms -> Domains -> example.int -> accounts -> forwarding is enabled (to internal@example.com). So everything works fine.

But if exchange sends mails out using hms as smtp relay there is a problem if the mails domain is equal to the domain "example.com". Then hms recognises the domain equal to the smtp route and tries to retrun the mail to exchange and doesn't send it out to the provider.

I changed the name of the smtp route to example.int and forwarded the mails to this domain. But then exchange doesn't accept them.

I want everything from exchange to be sent out by hms to my provider! No matter what domain is concerned.

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

Re: hMailServer with Exchange Server

Postby mattg » 2012-07-12 09:57

Can you name the route back to your exchange differently, and call it with an account rule (for each account) or from a script using OnExternalDownload http://www.hmailserver.com/documentatio ... ntdownload

and then make the route for that domain point to the externally hosted mailserver
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

avdreith
New user
New user
Posts: 6
Joined: 2008-10-03 16:54
Location: Germany

Re: hMailServer with Exchange Server

Postby avdreith » 2012-07-12 11:44

I tried the account rule! So far soooo good! Hopefully i won't experience any new Problems. But it looks promising!

Thank You!

avdreith
New user
New user
Posts: 6
Joined: 2008-10-03 16:54
Location: Germany

Re: hMailServer with Exchange Server

Postby avdreith » 2012-07-12 15:19

No it didn't work with account rules. I mistakenly left the forwarding checkbox checked and the "forward to" field as before. moreover i left my old smtp route example.com which led my mail to my exchange server.

What else i did: first I added a new route (exchange.int). Then added the account rule with predifined fields where "to"-field was a wildcard = *. The action was "Send using route" (exchange.int).
After i realised that the "forward to" checkbox was still checked i unchecked it. The result: No mail was delivered to exchange.

For test purposes i added an additional header with the rule mentioned above. This worked, the header was added. So the roule criteria was correct.

mattg what did i do wrong? everything seemed so logical.

The second question is about your link. What does this script do? For me it looks like it's only use is to delete messages from pop3 accounts. Is this script already integrated in hms? Are there examples for scripts in hms?

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

Re: hMailServer with Exchange Server

Postby mattg » 2012-07-13 01:57

try message size >0 as your condition in the ACCOUNT rule (as opposed to a global rule).

The link I posted was about a particular event that is available with hMailserver scripts
Here is more about scripts >> http://www.hmailserver.com/documentatio ... ce_scripts
Here is some samples using a similar 'event' - http://www.hmailserver.com/documentatio ... eptmessage
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

avdreith
New user
New user
Posts: 6
Joined: 2008-10-03 16:54
Location: Germany

Re: hMailServer with Exchange Server

Postby avdreith » 2012-07-13 09:22

Again:

pop3 domain = example.com
hms domain = example.int
hms route = example.com
exchange domain = example.com

Log File:
"DEBUG" 540 "2012-07-13 08:52:54.883" "Saving message: C:\Programme\hMailServer\Data\example.int\archiv\B1\{B12B34FB-CAB5-43AD-B074-DF4738736C7D}.eml"
"DEBUG" 540 "2012-07-13 08:52:54.883" "AWStats::LogDeliverySuccess"
"DEBUG" 540 "2012-07-13 08:52:54.899" "Local delivery completed"
"APPLICATION" 540 "2012-07-13 08:52:54.899" "SMTPDeliverer - Message 34146: Message delivery thread completed."
"DEBUG" 3340 "2012-07-13 08:52:54.914" "SMTPClientConnection::_ParseASCII()"
"SMTPC" 3340 5602 "2012-07-13 08:52:54.914" "192.168.100.254" "RECEIVED: 220 server.example.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.4675 ready at Fri, 13 Jul 2012 08:52:56 +0200 "
"SMTPC" 3340 5602 "2012-07-13 08:52:54.914" "192.168.100.254" "SENT: HELO Mailserver"
"DEBUG" 3340 "2012-07-13 08:52:54.914" "SMTPClientConnection::~_ParseASCII() - 2"
"DEBUG" 2080 "2012-07-13 08:52:54.930" "SMTPClientConnection::_ParseASCII()"
"SMTPC" 2080 5602 "2012-07-13 08:52:54.930" "192.168.100.254" "RECEIVED: 250 server.example.com Hello [192.168.100.4]"
"SMTPC" 2080 5602 "2012-07-13 08:52:54.930" "192.168.100.254" "SENT: MAIL FROM:<external@gmx.de>"
"DEBUG" 2080 "2012-07-13 08:52:54.930" "SMTPClientConnection::~_ParseASCII() - 4"
"DEBUG" 2080 "2012-07-13 08:52:54.930" "SMTPClientConnection::_ParseASCII()"
"SMTPC" 2080 5602 "2012-07-13 08:52:54.930" "192.168.100.254" "RECEIVED: 250 2.1.0 external@gmx.de....Sender OK"
"DEBUG" 2080 "2012-07-13 08:52:54.930" "SMTPClientConnection::~_ParseASCII() - 6"
"SMTPC" 2080 5602 "2012-07-13 08:52:54.930" "192.168.100.254" "SENT: RCPT TO:<internal@example.com>"
"DEBUG" 2080 "2012-07-13 08:52:54.930" "SMTPClientConnection::_ParseASCII()"
"SMTPC" 2080 5602 "2012-07-13 08:52:54.930" "192.168.100.254" "RECEIVED: 250 2.1.5 internal@example.com "
"SMTPC" 2080 5602 "2012-07-13 08:52:54.930" "192.168.100.254" "SENT: DATA"
"DEBUG" 2080 "2012-07-13 08:52:54.930" "SMTPClientConnection::~_ParseASCII() - 7"
"DEBUG" 3340 "2012-07-13 08:52:54.930" "SMTPClientConnection::_ParseASCII()"
"SMTPC" 3340 5602 "2012-07-13 08:52:54.930" "192.168.100.254" "RECEIVED: 354 Enter mail, end with "." on a line by itself"
"SMTPC" 3340 5602 "2012-07-13 08:52:54.930" "192.168.100.254" "SENT: [nl]."
"DEBUG" 1076 "2012-07-13 08:52:55.274" "SMTPClientConnection::_ParseASCII()"
"SMTPC" 1076 5602 "2012-07-13 08:52:55.305" "192.168.100.254" "RECEIVED: 250 2.6.0 <4FFFC51F.4010503@gmx.de> Queued mail for delivery"
"SMTPC" 1076 5602 "2012-07-13 08:52:55.305" "192.168.100.254" "SENT: QUIT"
"DEBUG" 1076 "2012-07-13 08:52:55.305" "SMTPClientConnection::~_ParseASCII() - 9"
"DEBUG" 2560 "2012-07-13 08:52:55.305" "SMTPClientConnection::_ParseASCII()"
"SMTPC" 2560 5602 "2012-07-13 08:52:55.305" "192.168.100.254" "RECEIVED: 221 2.0.0 server.example.com Service closing transmission channel"
"DEBUG" 2560 "2012-07-13 08:52:55.305" "Closing TCP/IP socket"
"DEBUG" 2964 "2012-07-13 08:52:55.305" "SD::~_InitiateExternalConnection-5"
"DEBUG" 2964 "2012-07-13 08:52:55.305" "SD::~_DeliverToExternalAccounts-1"
"DEBUG" 2964 "2012-07-13 08:52:55.305" "Collect delivery result"
"DEBUG" 2560 "2012-07-13 08:52:55.305" "Ending session 5602"
"DEBUG" 2964 "2012-07-13 08:52:55.305" "AWStats::LogDeliverySuccess"
"DEBUG" 2964 "2012-07-13 08:52:55.321" "Collect delivery result - Done"
"DEBUG" 2964 "2012-07-13 08:52:55.321" "Deleting message"
"DEBUG" 2964 "2012-07-13 08:52:55.321" "Deleting message file"
"APPLICATION" 2964 "2012-07-13 08:52:55.321" "SMTPDeliverer - Message 34145: Message delivery thread completed."


pop3 domain = example.com
hms domain = example.int
hms route = exchange.int
exchange domain = example.com

DEBUG" 540 "2012-07-13 09:04:25.867" "AWStats::LogDeliverySuccess"
"DEBUG" 540 "2012-07-13 09:04:25.867" "Local delivery completed"
"APPLICATION" 540 "2012-07-13 09:04:25.867" "SMTPDeliverer - Message 34160: Message delivery thread completed."
"DEBUG" 3540 "2012-07-13 09:04:26.258" "SMTPClientConnection::_ParseASCII()"
"SMTPC" 3540 5671 "2012-07-13 09:04:26.258" "192.168.100.254" "RECEIVED: 250 2.6.0 <external@gmx.de> Queued mail for delivery"
"SMTPC" 3540 5671 "2012-07-13 09:04:26.258" "192.168.100.254" "SENT: QUIT"
"DEBUG" 3540 "2012-07-13 09:04:26.258" "SMTPClientConnection::~_ParseASCII() - 9"
"DEBUG" 3340 "2012-07-13 09:04:26.274" "SMTPClientConnection::_ParseASCII()"
"SMTPC" 3340 5671 "2012-07-13 09:04:26.274" "192.168.100.254" "RECEIVED: 221 2.0.0 server.example.com Service closing transmission channel"
"DEBUG" 3340 "2012-07-13 09:04:26.274" "Closing TCP/IP socket"
"DEBUG" 2964 "2012-07-13 09:04:26.274" "SD::~_InitiateExternalConnection-5"
"DEBUG" 2964 "2012-07-13 09:04:26.274" "SD::~_DeliverToExternalAccounts-1"
"DEBUG" 2964 "2012-07-13 09:04:26.274" "Collect delivery result"
"DEBUG" 3340 "2012-07-13 09:04:26.274" "Ending session 5671"
"DEBUG" 2964 "2012-07-13 09:04:26.274" "AWStats::LogDeliverySuccess"
"DEBUG" 2964 "2012-07-13 09:04:26.274" "Collect delivery result - Done"
"DEBUG" 2964 "2012-07-13 09:04:26.274" "Deleting message"
"DEBUG" 2964 "2012-07-13 09:04:26.274" "Deleting message file"


Any Ideas?

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

Re: hMailServer with Exchange Server

Postby mattg » 2012-07-13 15:34

avdreith wrote:Any Ideas?

pop3 domain = example.com
hms domain = example.local
hms route (to externally hosted domain) = example.com
exchange domain = example.com (doesn't really matter)

hms route to exchange named somethingelse.local but points to exchange server

Seriously I have no idea why you are using such a convoluted setup.
External account in hMailserver connecting to externally hosted 'example.com' forwarding all mail to the exchange server, and then send all mail from your exchange server to the hMailserver and then to the externally hosted domain..

It seems to me that the hMailserver in the middle is redundant both ways, so why use it?
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

avdreith
New user
New user
Posts: 6
Joined: 2008-10-03 16:54
Location: Germany

Re: hMailServer with Exchange Server

Postby avdreith » 2012-07-14 15:51

My problem is/was that outgoing mails with email domain 'example.com' were send back to exchange by hms. I guess this happend because in hms there was a route example.com. Maybe I'm wrong with this. But for me this seemed to be the cause.

After realising that the two identical domains caused something like a loop I change the hms route to exchange.int. But than Exchange seemed to refuse those mails.

NOW the solution (hopefully): in exchange i added one additional mail adress like email@exchange.int to each account . Then Exchange accepted mails from hms (route: exchange.int)

Understood?!?!?! :?

Bill48105
Developer
Developer
Posts: 6171
Joined: 2010-04-24 23:16
Location: Michigan, USA

Re: hMailServer with Exchange Server

Postby Bill48105 » 2012-07-14 23:54

avdreith, I didn't read the whole thing but I setup a mail server in front of an exchange server for a client a few years ago & the trick to get it working was to setup a sub-domain that pointed to the exchange server & setup the exchange server to use the front-end mail server as the smarthost relayer. Not sure if that helps in your situation but figured I'd mention the sub-domain thing as it helps a ton when wanting to force messages to a particular place.

Example:
- mydomain.com mx points to mail.mydomain.com which is hmail
- x.mydomain.com is sub-domain that has relay set to 192.168.1.3 which is exchange
- On hmail you create a forward bob@mydomain.com to bob@x.mydomain.com so any mail to bob goes to exchange vs getting delivered on hmail
- In exchange setup users with mydomain.com & x.mydomain.com (exchange lets you add multiple SMTP addresses per user) but set mydomain.com as their default address so when they mail out it shows w/o x. Set that way exchange will accept email to bob@mydomain.com & bob@x.mydomain.com (the x ones should only happen for outside mail relayed thru hmail)
- In exchange set it up so 192.168.1.2 (your hmail box) is your smarthost relayer. That way all local mail (other exchange mail) gets delivered locally but any other mail gets set to your hmail box. Once there hmail will deliver locally mydomain.com mail otherwise it will forward on as outside mail.

Again this may not help you but perhaps it will at least give you a hints on how to solve your problem with some craftyness. :D
Bill
*** ABSENT FROM hMail! Those in IRC know how to find me if urgent. ***
hMailServer build LIVE on my servers: 5.4-B2014050402
Latest test builds: http://www.hmailserver.com/forum/viewtopic.php?f=10&t=21420

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

Re: hMailServer with Exchange Server

Postby mattg » 2012-07-15 01:10

avdreith wrote:After realising that the two identical domains caused something like a loop I change the hms route to exchange.int.

Yes, that is exactly what I've been trying to say.

Glad you got it sorted.
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation


Return to “General discussions”



Who is online

Users browsing this forum: No registered users and 3 guests