- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Sendmail : Change outgoing email Recipient's domai...
Operating System - HP-UX
1825552
Members
2429
Online
109681
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-27-2009 04:00 AM
тАО07-27-2009 04:00 AM
Sendmail : Change outgoing email Recipient's domain name
Our unix servers have numerous scripts configured in different directories to send out reports to exchange email addresses.
Our exhange server address is changing now(from @abc.com to @xyz.com) and not all of our above scripts use aliases. They use hardcoded email address within them( a not so good practise !)
Is there anyway to setup rules in sendmail so that any email sent from a script/shell or any mail client/pogram to@abc.com, is automatically changed to @xyz.com by sendmail before sending the mail out ? i.e if the shell script sends mail to johnsmith@hp.com, sendmail should actually send it to johnsmith@hewlettpackard.com ?
Please note we do not know all names to whom mails could be sent, so effectively sendmail should forward any mail sent to name@abc.com to name@xyz.com
Platform : HP-UX 11.11 on various HP 9000 and Itanium servers.
Thanks.
Our exhange server address is changing now(from @abc.com to @xyz.com) and not all of our above scripts use aliases. They use hardcoded email address within them( a not so good practise !)
Is there anyway to setup rules in sendmail so that any email sent from a script/shell or any mail client/pogram to
Please note we do not know all names to whom mails could be sent, so effectively sendmail should forward any mail sent to name@abc.com to name@xyz.com
Platform : HP-UX 11.11 on various HP 9000 and Itanium servers.
Thanks.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-27-2009 04:44 AM
тАО07-27-2009 04:44 AM
Re: Sendmail : Change outgoing email Recipient's domain name
I believe the answer to your question is NO. What you can do on the other hand is to replace the sendmail executable with a script and move the executable to some other name, say real_sendmail, you can build this intelligence into your script, replacing the sendmail.
a sample of how to do this is as follows. Please note that there is no error checking or any other consideration. It assumes you will use a simple command like 'sendmail email@domain.com' to send out emails. If you use any command line switches, you need to build this intelligence into your script as well.
mv /usr/sbin/sendmail /usr/sbin/real_sendmail
#!/usr/bin/ksh
#script name: /usr/sbin/sendmail
#
#this script replaces sendmail executable
#to capture and replace some a domain
#
RECEIVER=$1
name=`echo $RECEIVER | cut -d"@" -f1`
domain=`echo $RECEIVER | cut -d"@" -f2`
if [ "$domain" = "abc.com" ]
then
domain=xyz.com
fi
new_address="${name}@${domain}"
/usr/sbin/real_sendmail ${new_address}
Last but not the least, keep in mind that, any time you patch sendmail, it will overwrite your script. So, you have to remember to replace the executable with your script, after patching.
a sample of how to do this is as follows. Please note that there is no error checking or any other consideration. It assumes you will use a simple command like 'sendmail email@domain.com' to send out emails. If you use any command line switches, you need to build this intelligence into your script as well.
mv /usr/sbin/sendmail /usr/sbin/real_sendmail
#!/usr/bin/ksh
#script name: /usr/sbin/sendmail
#
#this script replaces sendmail executable
#to capture and replace some a domain
#
RECEIVER=$1
name=`echo $RECEIVER | cut -d"@" -f1`
domain=`echo $RECEIVER | cut -d"@" -f2`
if [ "$domain" = "abc.com" ]
then
domain=xyz.com
fi
new_address="${name}@${domain}"
/usr/sbin/real_sendmail ${new_address}
Last but not the least, keep in mind that, any time you patch sendmail, it will overwrite your script. So, you have to remember to replace the executable with your script, after patching.
________________________________
UNIX because I majored in cryptology...
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-27-2009 07:43 AM
тАО07-27-2009 07:43 AM
Re: Sendmail : Change outgoing email Recipient's domain name
Shalom,
There is a way to set up sendmail to do this.
http://www.sendmail.org
https://www.sendmail.org/tips/virtual-hosting.php
You need to set up virtusertables and genericstables to support the email addresses you want transmitted.
http://www.hpux.ws/buildmail.sendmail.text
That script shows the basics of building a sendmail configuration based on sendmail.mc or the HP-UX substitute.
If you run into specific issues, post back and I'll help you out.
I'll even help you do it if you want. http://www.isnamerica.com There is a contact form up there.
SEP
There is a way to set up sendmail to do this.
http://www.sendmail.org
https://www.sendmail.org/tips/virtual-hosting.php
You need to set up virtusertables and genericstables to support the email addresses you want transmitted.
http://www.hpux.ws/buildmail.sendmail.text
That script shows the basics of building a sendmail configuration based on sendmail.mc or the HP-UX substitute.
If you run into specific issues, post back and I'll help you out.
I'll even help you do it if you want. http://www.isnamerica.com There is a contact form up there.
SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-27-2009 08:53 AM
тАО07-27-2009 08:53 AM
Re: Sendmail : Change outgoing email Recipient's domain name
Your previous thread is here:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1358443
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1358443
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP