Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: hMailServer with Exchange Server
PostPosted: 2012-07-11 16:18 
New user
New user

Joined: 2008-10-03 16:54
Posts: 6
Location: Germany
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?


Top
 Profile  
 
 Post subject: Re: hMailServer with Exchange Server
PostPosted: 2012-07-11 17:41 
Normal user
User avatar

Joined: 2006-05-25 01:25
Posts: 77
Location: .nl
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'


Top
 Profile  
 
 Post subject: Re: hMailServer with Exchange Server
PostPosted: 2012-07-12 08:01 
New user
New user

Joined: 2008-10-03 16:54
Posts: 6
Location: Germany
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.


Top
 Profile  
 
 Post subject: Re: hMailServer with Exchange Server
PostPosted: 2012-07-12 09:57 
Moderator
User avatar

Joined: 2007-06-14 05:12
Posts: 11370
Location: 'The Outback' Australia
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.
Documentation


Top
 Profile  
 
 Post subject: Re: hMailServer with Exchange Server
PostPosted: 2012-07-12 11:44 
New user
New user

Joined: 2008-10-03 16:54
Posts: 6
Location: Germany
I tried the account rule! So far soooo good! Hopefully i won't experience any new Problems. But it looks promising!

Thank You!


Top
 Profile  
 
 Post subject: Re: hMailServer with Exchange Server
PostPosted: 2012-07-12 15:19 
New user
New user

Joined: 2008-10-03 16:54
Posts: 6
Location: Germany
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?


Top
 Profile  
 
 Post subject: Re: hMailServer with Exchange Server
PostPosted: 2012-07-13 01:57 
Moderator
User avatar

Joined: 2007-06-14 05:12
Posts: 11370
Location: 'The Outback' Australia
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.
Documentation


Top
 Profile  
 
 Post subject: Re: hMailServer with Exchange Server
PostPosted: 2012-07-13 09:22 
New user
New user

Joined: 2008-10-03 16:54
Posts: 6
Location: Germany
Again:

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

Log File:
Quote:
"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

Quote:
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?


Top
 Profile  
 
 Post subject: Re: hMailServer with Exchange Server
PostPosted: 2012-07-13 15:34 
Moderator
User avatar

Joined: 2007-06-14 05:12
Posts: 11370
Location: 'The Outback' Australia
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.
Documentation


Top
 Profile  
 
 Post subject: Re: hMailServer with Exchange Server
PostPosted: 2012-07-14 15:51 
New user
New user

Joined: 2008-10-03 16:54
Posts: 6
Location: Germany
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?!?!?! :?


Top
 Profile  
 
 Post subject: Re: hMailServer with Exchange Server
PostPosted: 2012-07-14 23:54 
Developer

Joined: 2010-04-24 23:16
Posts: 5887
Location: Michigan, USA
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

_________________
hMailServer build LIVE on my servers: 5.4-B2014011501
Latest test builds: http://www.hmailserver.com/forum/viewtopic.php?f=10&t=21420
Urgent? Bored? JOIN US ON IRC!
DOGE ME: DSqtEcqP3Qv6Tj2XrGNpDmEUkSBcpBsuWk


Top
 Profile  
 
 Post subject: Re: hMailServer with Exchange Server
PostPosted: 2012-07-15 01:10 
Moderator
User avatar

Joined: 2007-06-14 05:12
Posts: 11370
Location: 'The Outback' Australia
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.
Documentation


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 


Who is online

Users browsing this forum: No registered users and 8 guests



Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group