LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Unable to change the sender from root to user in postfix (https://www.linuxquestions.org/questions/linux-server-73/unable-to-change-the-sender-from-root-to-user-in-postfix-4175413619/)

Pratique 06-27-2012 04:51 AM

Unable to change the sender from root to user in postfix
 
Hi All,

I have a Linux 2.6 x86 machine and currently I am battling with email deployment on it. The problem is by default the server sends emails through the address root@localdomain.com which is not valid.
I want the sender to be changed to username@newdomain.com.

So far, after days of googling, I have been able to change only the domain part and now the server sends mail through root@newdomain.com which is again invalid.

I have updated the following entries:
/etc/postfix/generic
/etc/postfix/main.cf
/etc/postfix/alias

But still the mail appears to use the root username for sending which does not get delivers, here are the logs :

[root@myserver]# tail -f /var/log/maillog
Jun 27 05:11:54 myserver postfix/pickup[12653]: C86C9115027: uid=0 from=<root>
Jun 27 05:11:54 myserver postfix/cleanup[16739]: C86C9115027: message-id=<20120627091154.C86C9115027@myserver.localdomain>
Jun 27 05:11:54 myserver postfix/qmgr[12654]: C86C9115027: from=<root@newdomain.com>, size=301, nrcpt=1 (queue active)
Jun 27 05:11:56 myserver postfix/smtp[16741]: C86C9115027: to=<abc@xyz.com>, relay=smpt.relay.server[10.135.40.20]:25, delay=1.6, delays=0/0/1.2/0.42, dsn=5.1.7, status=bounced (host smpt.relay.server[10.135.40.20] said: 550 5.1.7 <root@newdomain.com>... Unknown sender (in reply to MAIL FROM command))
Jun 27 05:11:56 myserver postfix/cleanup[16739]: BB551115028: message-id=<20120627091156.BB551115028@myserver.localdomain>
Jun 27 05:11:56 myserver postfix/qmgr[12654]: BB551115028: from=<>, size=2215, nrcpt=1 (queue active)
Jun 27 05:11:56 myserver postfix/bounce[16742]: C86C9115027: sender non-delivery notification: BB551115028
Jun 27 05:11:56 myserver postfix/qmgr[12654]: C86C9115027: removed
Jun 27 05:11:58 myserver postfix/smtp[16741]: BB551115028: to=<root@newdomain.com>, relay=smpt.relay.server[10.135.40.20]:25, delay=1.6, delays=0/0/1.2/0.43, dsn=5.1.1, status=bounced (host smpt.relay.server[10.135.40.20] said: 550 5.1.1 <root@newdomain.com>... Unknown user (in reply to RCPT TO command))
Jun 27 05:11:58 myserver postfix/qmgr[12654]: BB551115028: removed

[root@myserver]#


Can anyone please help me?

descendant_command 06-27-2012 07:03 AM

So what is creating the mail?
You need to configure that.

Also what rules does your relay server enforce?

Pratique 06-27-2012 08:58 AM

Where should I configure ?
 
I used the following command to send the mail:

Echo "Hello World" | mail -s "GM" abc@xyz.com

and received the log which I pasted above. As far as SMTP Relay setting are concerned, the entries are updated properly. Issue is to change the sender from root@newdomain.com to user@newdomain.com.

descendant_command 06-27-2012 03:36 PM

So log in as 'user' not 'root', and then send the mail...

Pratique 06-28-2012 04:17 AM

Netbackup Application
 
My need is to make netbackup deliver emails. Netbackup uses the mailx utility on the server to send mails (which is root by default).
But here root's address is invalid and it does not sends mail.

That's why I am looking for an alternative to send emails.

descendant_command 06-28-2012 04:32 AM

From 'man mailx'

Quote:

-r address
Sets the From address. Overrides any from variable speci‐
fied in environment or startup files. Tilde escapes are
disabled. The -r address options are passed to the mail
transfer agent unless SMTP is used. This option exists
for compatibility only; it is recommended to set the from
variable directly instead.

Reuti 06-28-2012 05:39 AM

I suggest lines in sender_canonical like:
Code:

/root@localdomain.com/ user@newdomain.com
/^(.*@)(.*)$/    ${1}newdomain.com

and access it in main.cf:
Code:

sender_canonical_maps = regexp:/etc/postfix/sender_canonical
As it’s a regexp, there is no postmap necessary. But you can also use a hash, if it suits your needs better

Documentation

Pratique 06-28-2012 08:47 AM

Still not working
 
Is there anything I need to change in main.cf file ?
The system continues to send mails through root.

@descendant_command The "-r" switch cannot be specified. Netbackup communicates with the server in the background and calls mailx. There is no way I can put a switch to the emails sent.

Reuti 06-28-2012 08:49 AM

The sender_canonical_maps line is in main.cf and you restarted postfix?

Pratique 06-28-2012 11:54 AM

Yes I did restart.
 
The postfix was reloaded after making changes.


All times are GMT -5. The time now is 12:46 PM.