Koozali.org: home of the SME Server

Internal Emails going out and coming in

Offline ekeis98

  • *
  • 9
  • +0/-0
Internal Emails going out and coming in
« on: July 27, 2007, 03:47:30 PM »
Hi all,

hopefully this question hasn't been asked until now. So far I haven't found it, so please be patient if it has been asked.

My problem is: internal emails seem to leave the internal network, going into the internet an are being fetched again to get delivered to the internal recipient. My wish was: Internal email should be delivered directly to the recipient and only those emails which are addressed to external recipients (users which are not defined locally) should leave the local network. Because in that case emails from local users to local users will take an unaccetable amount of time.

We have an email provider for our domain xyz.de. That domain is used by our external people getting email directly via pop3 and our internal guys which are getting their emails from the SME 7.1 server which ist fetching all emails with fetchmail and distributing it to the local configured users (email recipients).

The internal domain is called xyz.local because this is my understanding of configuring local domains to distinguish from external domainnames. Maybe this the reason of my problem. But, for example configuring an M$ Exchange Server you have an internal (xyz.local) domain and your external domain (xyz.de). The M$-Server realizes by its entries in the email field (i.e. john.smith@xyz.de) which users are local and which are external. So the server devides to transfer the emails into the internet or direcly local.

So, simply spoken, my wish is:
local user emails to local user -> email should be delivered directly immediately
local user emails to external user-> email should be transfered to the internet

I hope, I could describe my problem sufficiently.

I appreciate any explanation or link to a description to solve my problem.

Thanks in advance for your help.
Regards,
Oliver

Offline jonic

  • *
  • 103
  • +1/-0
Internal Emails going out and coming in
« Reply #1 on: July 27, 2007, 04:52:52 PM »
You could use only SME as your email server and have your external guys connect to it via pop3s.

If you change the domanin in sme fron xyz.local to xyz.de, emails from your internal network sent to the external guyz will not reach the external email server. (and in fact will return an error if the external guyz are not configured as users on SME).

Offline ekeis98

  • *
  • 9
  • +0/-0
Internal Emails going out and coming in
« Reply #2 on: July 27, 2007, 05:45:38 PM »
Thanks for your hints.

But to avoid misunderstanding: I don't want the externals to connect to my SME server. They will use the email server of our webhoster.

My only question ist: how to configure my system that emails from locals will be delivered directly to other locals without doing the way over the internet and back.
Regards,
Oliver

Offline raem

  • *
  • 3,972
  • +4/-0
Internal Emails going out and coming in
« Reply #3 on: July 28, 2007, 05:23:03 AM »
ekeis98

Quote
how to configure my system that emails from locals will be delivered directly to other locals without doing the way over the internet and back.


sme is not an Exchange server, so don't apply setup "rules" that are not appropriate for sme.

You are sending to an externally hosted email address, so the email will be delivered externally. Keep in mind that sme knows nothing about that domain (zyx.de).
As it is now, if you want to send locally you need to send to the local domain address ie user@xyz.local

You could setup a virtual domain on your server for zyx.de and then any mails sent locally should be delivered locally as sme will know about that domain. This will only apply to the local network, and not to externally sent emails. For external users the domain zyx.de will resolve to your external ISP.

Of course DO NOT publish external DNS records that point zyx.de to your sme servers external IP.
...

Offline jonic

  • *
  • 103
  • +1/-0
Internal Emails going out and coming in
« Reply #4 on: July 29, 2007, 02:19:24 PM »
Quote from: "RayMitchell"

You could setup a virtual domain on your server for zyx.de and then any mails sent locally should be delivered locally as sme will know about that domain. This will only apply to the local network, and not to externally sent emails. For external users the domain zyx.de will resolve to your external ISP.


If he does this, doesn't it mean that emails from internal sme users won't be able to reach the external users (as they are configured only on the provider's server)?

Offline raem

  • *
  • 3,972
  • +4/-0
Internal Emails going out and coming in
« Reply #5 on: July 30, 2007, 02:03:35 AM »
ekeis98 , jonic

Quote
You could setup a virtual domain on your server for zyx.de

Quote
..emails from internal sme users won't be able to reach the external users...


Yes, internally you will only be able to send to internal users (on that virtual domain), which is a problem itself.

If that's an issue, then for internal users to internal users, just to send to the local address, user@xyz.local
...

Offline barame

  • **
  • 26
  • +0/-0
Internal Emails going out and coming in
« Reply #6 on: August 02, 2007, 12:03:32 PM »
Hi oliver
I think you better setup sme as domain zyx.de not to zyx.local beause the concept of sme is looking for local account and if not match any name or alias that are not local email and it will sent out to the internet.
For my system also have the solution as your.
I have hosting for my domain at ISP and all email in goto there.
External email will go into hosting mailbox. my sme get those mail by using fetchmail.
for Internal user send mail to each other via same domain. the email just store in sme and ready to send to another user. not go outside.
But when internal user send email to another domain sme will deliver directly to recipent domain. if any error sme will transfer to my ISP smtp server.

Barame

Offline p-jones

  • *
  • 594
  • +0/-0
Internal Emails going out and coming in
« Reply #7 on: August 02, 2007, 01:47:43 PM »
I think it would be possible to follow Ray Mitchell's suggestion (virtual domain)  and put in forwarding address for those users that are off site which forwards the mail to the hosting ISP's mail server/users mailbox.

Off site users would each need an account on the local SME server

I have certainly used this approach sucessfully however I am aware that different ISP implement hosted domains in different ways and that this option may not always work.
...

Offline ekeis98

  • *
  • 9
  • +0/-0
Internal Emails going out and coming in
« Reply #8 on: August 06, 2007, 09:25:16 AM »
Yes, thanks. That worked, in principle. I've edited the qmail configuration file ../virtualdomains and evertything was fine.

But, now another problem has come up: I've read the hint in the file not to edit because it would re-edited by the automatic configuration procedure. And so it was. After reconfiguring via the webconfiguration tool my virtual domains dissappeared, also my additional aliases (the webconfiguration for user aliases didn't work for additional email aliases).

So, which files do I have to edit to configure virtualdomains and additional emailaliases?

Thanks for your help.
Regards,
Oliver

Offline raem

  • *
  • 3,972
  • +4/-0
Internal Emails going out and coming in
« Reply #9 on: August 06, 2007, 08:04:33 PM »
ekeis98

> So, which files do I have to edit to configure virtualdomains and additional emailaliases?

Are you saying that you have not discovered the server manager yet ?
Use the Domains panel & Pseudonyms panel.
Have you read the manual linked at the top of these forums ?
...

Offline ekeis98

  • *
  • 9
  • +0/-0
Internal Emails going out and coming in
« Reply #10 on: August 06, 2007, 09:19:02 PM »
RayMitchell, thanks for your replay.

Of course I've read the manual and discovered the server-manager, but there are some reason for my questions.

1) ## aliases
As I wrote, the alias doesn't work for email aliases. That means: I configured a username jsmith, with john as the first name and smith as the surname. So automatic aliases were created johnsmith, john.smith, jsmith etc. But in this example I need j.smith@mydomain.local. So I defined a pseudonym j.smith for user jsmith. But the email j.smith@mydomain.local didn't reach me. So I edited the file '/../aliases' and that worked. So, what file do I have to edit that my manual configuration would stand the automatic configuration mechanism?

2) ## virtualdomain
The domainname of my domaincontroller is mydomain.local This is important because we have external colleagues that have naturally our external, official domain name in their email address. They get their emails delivered by our official provider directly via pop3. So my colleagues write emails to internal (local) recipients and external ones with the same domain name. If I would set the local domain name to our official domain name, every message to our externals would bounce wih an error. This is my dilemma. That is why I work with virtualdomain and it works. But, the same question as above, how do I manage it to keep my configuration file preserved from any changing by the automatic configuration procedure?

Thanks for your help.
Regards,
Oliver

Offline raem

  • *
  • 3,972
  • +4/-0
Internal Emails going out and coming in
« Reply #11 on: August 07, 2007, 02:26:11 AM »
ekeis98

Step 1 first.

You must add the Domain in the Domains panel, if it is not already there.
If the main domain of your sme server is mydomain.local, which you would have configured when you first ran the Configure my server screens, then you should see that domain name in the Domains panel.

If your main domain name is something else, then add the Virtual domain in the Domains panel. You can have as many Domains as you want.

Step 2

You can only add pseudonyms for valid existing domains on your sme box. If mydomain.local is not in the Domains panel, then you won't be able to add a pseudonym for it.
If you want to add other domain pseudonyms for j.smith, then you need to add j.smith as a user first in the User panel, then add pseudonyms for j.smith@domain1, j.smith@domain2 etc.

Note that as soon as you add the user j.smith, that user will receive all mail for j.smith@anydomain, unless you add pseudonyms for j.smith @otherdomains.

Re-read the chapter in the manual about Pseudonyms, I wrote the additional configuration information part.

I can do this on my server.
I have a main domain called happy.com
I have virtual domains added in the Domains panel called
sad.com
and lazy.com

In the User panel I add j.smith
In the pseudonyms panel I can add a pseudonym for
j.smith@sad.com and deliver it to ray (a valid user)

I can also add a pseudonym for
j.smith@lazy.com and deliver it to john (another valid user)

mail sent to j.smith@happy.com will automatically go to the user j.smith
...

Offline ekeis98

  • *
  • 9
  • +0/-0
Internal Emails going out and coming in
« Reply #12 on: August 07, 2007, 03:50:25 PM »
Hey Ray, pretty good description, thanks for that.

But, it didn't solve my problem :-( the reason for that is simple: If you define an external domainname in your local server, then every email for a user which is not defined local will not be delivered if he has the same domainname as the local one. Please have a look at my example:

Two email users, one local, on external.

Our local guy gets his email from our SME-server which is getting all emails (except the external ones) via fetchmail. Let's say, the SME-server is working as an email proxy. Local users are known to the system.

The external guys are NOT defined local, because they get their email directly from our internet provider via pop3. The external guys don't access our SME-server. This ist volitional because of security reasons. So, this is why external guys are unknown to our SME-server.

1) jsmith has a local address (SME-server emailaddress) jsmith@mydomain.local. Fetchmail is queriing his pop3-server with his emailaccount jsmith@externaldomain.com and delivers it to the SME-server-user jsmith locally.

2) abecker has NO local address. He gets his mail via pop3 directly using his personal email client and accessing pop3.externaldomain.com with his username abecker@externaldomain.com. He has nothing to do with SME. He has NO account locally on our SME.

Now I define externaldomain.com as an additional domain name. So I have two domain names: mydomain.local and externaldomain.com (the last one of course with internet dns).

jsmith wants to write an email to abecker. What happens now: jsmiths' emailis is routed to SME's Qmail. Qmail is checking the table of local users according to the local defined list of domainnames. Qmail finds the local defined domainname externaldomain.com. Now Qmail is looking for a user whichs fits abecker@externaldomain.com and Qmail can't find it because abecker is not defined locally. Qmail breaks up looking for the user and delivers the email to the postmaster, catchall or whatever.

So, simply spoken: If you define your external domainname locally, your local created emails addressed to an external recipient with NO local account (but with an external pop3-account) will not leave the local system.

Well, this is the reason for my manually edited file virtualdomains:


Code: [Select]

mydomain.local:alias-localdelivery
jsmith@externaldomain.com:alias-localdelivery
[/size]

This won't work:

Code: [Select]

mydomain.local:alias-localdelivery
externaldomain.com:alias-localdelivery
[/size]

...because external users won't get their emails.

I hope, this description was sufficient.

But unfortunately my manually file will be overwritten on every reconfiguration. So, what to do?
Regards,
Oliver

Offline raem

  • *
  • 3,972
  • +4/-0
Internal Emails going out and coming in
« Reply #13 on: August 07, 2007, 04:25:05 PM »
ekeis98

Your setup is too convoluted. There are easier ways to do it with functionality that is in sme already, depending on your preferences and specific technical requirements, which I don't know.
eg
Hostnames & Addresses panel to redirect requests

Delegate email server by domain using db commands to send mail for one domain to an external mail server yet process mail for another domain locally.

Have the same externalusers@localdomain on your sme server and setup forwarding in the user accounts to external email addresses

To edit configuration files and prevent them being overwritten you create custom templates and put your changes in there, the config file even tells you that. Read the Development manual for details of the technique, many examples appear in the forums, you just need to work out which template and fragments to use, which is based on the config file you wish to change.

I don't understand your situation that well, but I personally think Delegate mail server method may be appropriate. Create both your local domain & external domain on your sme server. Only publish external DNS records that point requests for your local domain to your sme box. Requests for the external domain should be configured in external DNS records to go to the external hosted site.
Edit left this step out:
Issue the db commands to only configure mail for your external domain to use the external mail server. Search the FAQ or technical manual for this
end of edit
Email sent locally to externaluser@externaldomain will be delivered to the external mail server. Emails sent to localusers@localdomain will be delivered locally.
...