Koozali.org: home of the SME Server

Relay unknown users to another smtp server

Offline johnfrost

  • 2
  • +0/-0
Relay unknown users to another smtp server
« on: March 15, 2013, 05:06:03 PM »
Hello all,

It's my first time to post, please bear with me.

We have and small office branch of 30 people and most of the time that they are doing are emailing vendors and clients. The management asked me if I could improve the sending of emails because if they send email with attachment with there neighboring cubicle it would take a lot of time. What I did was I set up a local smtp server (sme server 8). I configure their email clients with two email accounts. 1st account having the configuration of our mail server (located remotely in our HQ) and the 2nd account is configure with my sme server. Everything was working except when they send an email account which is not existing in my local sme, it will be rejected. What I would like to achieve is that when I send john@mydomain.com if john is not existing in me local sme it will be relayed to our head quarters smtp server.

Any help would be appreciated.

Tnx
John 

Offline mmccarn

  • *
  • 2,653
  • +10/-0
Re: Relay unknown users to another smtp server
« Reply #1 on: March 15, 2013, 11:48:10 PM »
Painful way:
Define all of the HQ users on the SME server and configure each account to 'forward' all email to a secondary email address for each user at HQ.

Easy way:
I don't know one for SME server.

Offline Franco

  • *
  • 1,171
  • +0/-0
    • http://contribs.org
Re: Relay unknown users to another smtp server
« Reply #2 on: March 16, 2013, 02:29:41 AM »
Hi,
1. Create an account on SME
2. Change the setting on this account so it forwards all emails to where you want it go.
3. Modify the Email panel and change the setting from reject to this newly created user.

Done.


Offline johnfrost

  • 2
  • +0/-0
Re: Relay unknown users to another smtp server
« Reply #3 on: March 16, 2013, 06:28:58 AM »
Hi mmccarn and Franco,

Thank you for your replies but I manage to solve the problem. Just in case anyone run into situation, here is what I  did.

create file in /etc/e-smith/templates/var/qmail/control/virtualdomains/ directory name it 90pseudonyms_test1 for example. Open the created file 90pseudonyms_test1 and insert lines like this: john@mydomain.com:john

john is our sme account and john@mydomain.co is your alias. After inserting it, save the changes and execute: signal-event email-update

note: 1 alias 1 line

Regards
John





Offline mmccarn

  • *
  • 2,653
  • +10/-0
Re: Relay unknown users to another smtp server
« Reply #4 on: March 17, 2013, 04:05:47 PM »
Oh...
My...
God.

So simple.

Now that you've shown me how to do this, I thought the existing 'pseudonym' function might also do what you want using a db setting.

A little testing shows that if I do this:
Code: [Select]
db accounts set m.mccarn@otherdomain.com pseudonym Account mmccarn
signal-event email-update

Then:
* email sent to "m.mccarn@otherdomain.com" (using my SME server as the SMTP server in Thunderbird) is delivered to my local mmccarn mailbox
* email sent to "otheruser@otherdomain.com" still goes to the otherdomain.com mail server.
* the resulting pseudonym is visible and can be deleted from the Pseudonyms panel in server-manager

However, I can't create the off-site pseudonym in server-manager (if I try I get an error saying `That domain is not hosted on this server').


[edit]
If I manually create a "fake" domain from the command prompt:
Code: [Select]
db domains set otherdomain.com domain-split

then:
* I can create new pseudonyms for the fake domain in server-manager
* the fake domain doesn't affect any of the usual templates or configurations, which scan the domains database for entries of type 'domain' or 'domain-remote'
« Last Edit: March 17, 2013, 04:22:40 PM by mmccarn »