Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 02-06-2008, 02:30 PM   #1
Registered: Jun 2006
Posts: 54

Rep: Reputation: 15
Set sender address with /bin/mail

/usr/bin/ldapsearch -x -ZZ -w "$LDAPPASS2" -b "dc=comain,dc=com" -D cn=user,ou=agents,dc=domain,dc=com "cn=$@" 2>&1 | /myscripts/pipe-to /bin/mail -s 'New list '$@' created'

I'm using the above line in a bash script that sends the results of an ldapsearch to my email address. The address comes with the From: address set to the user that script is executed as. How would I change the above line so that I can specify the From: address of the email manually?

I tried man mail, and google, but I wasn't able to find a way to set the from address using /bin/mail. I found one google link that suggested I could set the from address by appending '-- -f' to the above line, but that didn't seem to work.

Any suggestions?
Old 02-06-2008, 09:59 PM   #2
Registered: Feb 2008
Posts: 67

Rep: Reputation: 17
Try metamail. It allows setting the From header. Alternatively, you can send a properly-formatted message directly to sendmail.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
qmail: how can I block emails which have no sender address? hamish Linux - Networking 0 08-16-2006 04:16 PM
how to set 'from' address in linux 'mail' program nickleus Linux - General 4 04-27-2006 10:48 AM
'send from' address using /bin/mail turbo_acura Linux - Software 1 01-17-2006 11:25 AM
Sendmail: Domain of sender address does not exist 360 Linux - Networking 1 02-02-2003 08:40 PM
Sendmail Domain of sender address does not exist mantiev Linux - Networking 0 05-08-2001 07:58 AM

All times are GMT -5. The time now is 10:42 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration