Sending Email from Secondary Domain

Hi there,

Just finished setting up my Nethserver and I’m very happy so far. However, I’m having one tricky issue with email. I’ve read a number of posts describing very similar issues but haven’t been able to find anyone who resolves exactly what I’m struggling with.

I’m hosting a small email server (approx 12 accounts) on my business internet line (no smart host, port 25 is open). Most of the users are family members, but I have three work colleagues on a separate domain for our business.

Currently, I have three domains configured, we’ll call them family1.tld, family2.tld and work.tld. Family1.tld is the default domain. I don’t mind if my work colleagues login with user@family1.tld, but they need to be able to send messages as user@work.tld and that doesn’t seem to work. While they can receive messages at user@work.tld, all of the outgoing messages come from user@family.tld. Is there a way to assign a user a different outgoing mail domain? Surely, I’m not the only person wanting users to be able to send mail from a mail alias?

Thanks!
Ted
NethServer Version: 7.9.2009
Module: Email

Which is the software that you’re using for sending email?

Here is a basic idea you can work on:

1 Like

I use Apple mail. One colleague will probably use SOGo. I think the other uses outlook.

Interesting. I’ll give that a whirl. :slight_smile:

saitobenkei,

I notice that main.cf has an “autogenerated” warning. Do you know where I can make these changes in Nethserver and not have them overwritten? Is there an overrides file or something?

Thanks!
Ted

Try this:

I wrote this on the fly and haven’t tested if it works… but it should

First you need the directory structure that contains the main.cf fragment

mkdir -p /etc/e-smith/templates-custom/etc/postfix/main.cf
cd /etc/e-smith/templates-custom/etc/postfix/main.cf

Then create the fragment of the file:

vi 41sender_maps

and in 41sender_maps just write this line

smtp_generic_maps = hash:/etc/postfix/sender_rename

Save the file and give the command to regenerate /etc/postfix/main.cf

expand-template /etc/postfix/main.cf

If you go to see the file /etc/postfix/main.cf you’ll see that it added the new line

You create the file /etc/postfix/sender_rename

vi /etc/postfix/sender_rename

 user@localdomain.local   account@isp.example.com
 @localdomain.local       wholedomain@isp.example.com

save and then give the commands

postmap /etc/postfix/sender_rename
signal-event nethserver-mail-server-update
7 Likes

Worked perfectly! Thanks so much!

1 Like

I’d use only some client settings, but mr @saitobenkei ruled out a problem like a champ.

4 Likes

Thank you so much that’s what I wanted!

1 Like

Let’s make things more complex … Is it possible not only to rewrite the send email but also the reply to?
:stuck_out_tongue_winking_eye:

Configuring the email client?

Hi, I wanted this rewriting to take place automatically with postfix, as it already does on the sender.

This worked great for some time, but I’ve noticed recently that things are going a bit haywire.

I have my primary address we’ll call it ted@main.com and then I have a second-ted@main.com which should rewrite to ted@secondary.com. At the moment, this is flopped. Anything I send from ted@main.com arrives from ted@secondary.com and anything from second-ted@main.com comes from second-ted@main.com.

I saw this and thought, surely I must be misremembering and it’s been broken all along. So I went to check my /etc/postfix/sender_rename

It shows the proper mapping. second-ted@main.comted@secondary.com.

Could this have been broken in an update? Any suggestions on how to fix it?