Visit Our UNIX and Linux User Community

How to force Sendmail to Rewrite Sender Address?

Thread Tools Search this Thread
Operating Systems Solaris How to force Sendmail to Rewrite Sender Address?
# 1  
Old 06-23-2011
How to force Sendmail to Rewrite Sender Address?

Need to change sender email id from applmgr@<hostname>.<domain-name> to applmgr@domain-name.

Understand we can change in the where $j is the hostname.domain-name.. can anyone show the exact value to change?

Thank you.
# 2  
Old 06-23-2011
You need a rewrite rule. They and their placement in different ruleset numbers vary by sendmail version. Each rewrite rule runs until it does nothing, recursively, so be careful. They are a bit like sed s, but I forget already, and have to google. SMTP
Addresses are already reformatted by the time most rewrite rules see them, adding to the fun. "echo 'some_addr'|sendmail -bt" returns some indication of what rules are up to. (mnemonic - Become Tester -bt)

So, find out which sendmail version you have, and google around for sendmail rewrite rule ruleset.

Not linked to the web, but I stole this a few decades back, for an old sendmail version:

This looks just right for you:
# 3  
Old 06-24-2011
Thanks for your reply. It's really a lot need to absorb Smilie.. will try to pick up. It will be good if someone has already done can show me the steps..Smilie

Anyway, thanks for sharing.
# 4  
Old 06-24-2011
The last link is just your case, if you have the same version of sendmail.

Sendmail has a history of punishing the rash and reading impaired, and has a very thick, maybe 2 volume, Riley book for the so inclined. I just tinker and google, very carefully. For some rewrites, you cannot get here from there in one line, you have to make something else in the middle of two or more rules to avoid pitfalls like infinite looping.
# 5  
Old 06-24-2011
The version we have is: Sendmail 8.13.8+Sun/8.13.8/Submit

I'm following the steps from Hints about sendmail/e-mail and it seems not work in my environment yet. Not sure the 'smart_host' is the variable or the parameter that we have to follow..
Need to thorough test & trace.. can anyone help me in this?
# 6  
Old 06-27-2011
Removing a top domain is the same as removing a host. Test it like this, for ruleset 10 and below:
$ sendmail -bt -C config_file
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> 10
rewrite: ruleset  10   input: someguy @ shomehos . somedomain . com
rewrite: ruleset  50   input: someguy @ shomehos . somedomain . com
rewrite: ruleset  50 returns: someguy @ shomehos . somedomain . com
rewrite: ruleset  94   input: someguy @ shomehos . somedomain . com
rewrite: ruleset  93   input: someguy @ shomehos . somedomain . com
rewrite: ruleset  93 returns: someguy @ shomehos . somedomain . com
rewrite: ruleset  94 returns: someguy @ shomehos . somedomain . com
rewrite: ruleset  10 returns: someguy @ shomehos . somedomain . com

# 7  
Old 07-04-2011
There are so many ruleset and I really don't know which one to change. Smilie

root@devdb # sendmail -bt -d0.1 < /dev/null
Version 8.13.8+Sun

============ SYSTEM IDENTITY (after readcf) ============
      (short domain name) $w = DEVDB
  (canonical domain name) $j = DEVDB.<domain name>
         (subdomain name) $m = <domain name>
              (node name) $k = DEVDB

ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>

Last edited by pludi; 07-05-2011 at 05:16 AM..

Previous Thread | Next Thread
Test Your Knowledge in Computers #196
Difficulty: Easy
Javascript ranked significantly higher than Python according to the TIOBE Index for October 2019.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Mailx command to include sender address

Hi, I m using mailx to send email. I am using sender=server name(display name) echo "body" | mailx -s "subject" -b "bcc address" "to address" -- -f "$sender". I should get email with sender as only display name. In stead i am getting displayname@server address. Please suggest Use code... (1 Reply)
Discussion started by: usrrenny
1 Replies

2. UNIX for Advanced & Expert Users

Sendmail Rewrite Ruleset

Hi all, I like to write a rule which do the following: INPUT ADDRESS REWRITTEN TO ----------------------------- ----------------------------- ... (1 Reply)
Discussion started by: bashily
1 Replies

3. AIX

Sendmail on AIX adding header rewrite

Hi, I have been having issues with sendmail service on the AIX server recently with header rewrite on few random email generated from the scripts or programs. I'm not sure what is causing as rest of the emails from the sever is generating correctly? AIX Server --> GATEWAY SERVER(Serv2smtp)... (4 Replies)
Discussion started by: musu1982
4 Replies

4. Linux

Sendmail has these errors--Domain of sender address <> does not exist

Does anyone has a clue of what is going on here? It was working few days ago. /etc/hosts looks ok, sendmail does restart without any errors, telnet is successful. I will be happy to send you guys any output required. Diagnostic-Code: SMTP; 553 #5.1.8 Domain of sender address... (1 Reply)
Discussion started by: lovesaikrishna
1 Replies

5. Shell Programming and Scripting

Changing the sender Email address to Alias

Hi All, I want to change the email address of the sender to some alias for eg: needs to be changes to TEST Please help me. (3 Replies)
Discussion started by: sithara
3 Replies

6. UNIX for Advanced & Expert Users

postfix sender address rewriting

Hi, I have a postfix server that relays to an exchange server. All of my unix/linux systems send to this server, the problem is the form the mail is sent with, the sender address is username@hostname.domain.local I need to rewrite every sender address to for... (0 Replies)
Discussion started by: funksen
0 Replies

7. Shell Programming and Scripting

Sender email address has to changes

I am sending email with attachment using mail and uuencode command. Ex: (echo "$EMAIL_BODY"; uuencode $FILE ATTACH.TXT) || mail "$EMAIL_ID" -s "$EMAIL_SUB" I am getting email from "". I want to change this email address into... (1 Reply)
Discussion started by: balajiora
1 Replies

8. UNIX for Dummies Questions & Answers

Different Sender Address

Hello Following command send link to division managers. echo http://severname:8081/account-reports/2008Jun19-2008Jun25.2/index.html | mail -s "Weekly Division Sales Report" QUESTION. Above command send a body which is link of division report in email with... (1 Reply)
Discussion started by: paulds
1 Replies

9. AIX

Change sender e-mail address

When sending emails to the outside world, aix present itself as This is causing some issue with our e-mail server. So we need to change the name to Does any one know how this can be accomplished? Thank you (3 Replies)
Discussion started by: cchiang12
3 Replies

10. UNIX for Dummies Questions & Answers

mailx sender address customisation

Hi All, I'm on UNIX -Solaris... I'm trying to send mail usin Mailx..... The script is working fine and attachments are also being sent.... BUT, when I receive the mail,, the sender address shown is the unix login id name.... Any way by which I could manipulate this in my script command or any... (1 Reply)
Discussion started by: vasan_srini
1 Replies

Featured Tech Videos