LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-05-2011, 04:19 AM   #1
sinoob
LQ Newbie
 
Registered: Feb 2004
Posts: 6

Rep: Reputation: 0
Sending mail from shell script


I tried the command
echo "Test" | mailx -s "Test subject" reciever@test.com -- -f Tester@gmail.com

But in the mailbox of reciever, i can find the sender name as Tester@gmail.com. My requirement is to show the sender as 'Tester' alone, without the domain name.
Is there any way ?
 
Old 07-05-2011, 09:23 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
What is the user name you ran the command as? What does its /etc/passwd line look like? What are you using to send the mail to the Internet (sendmail, postfix ...)? Which ISP's presumably SMTP server are you sending it by?
 
Old 07-05-2011, 11:07 AM   #3
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
instead of mailx try sendEmail script which is doing what you want and the right way (composes message with all Headers & stuff)

good luck
 
Old 07-07-2011, 08:43 AM   #4
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
AFAICS sendEmail will only accept a valid email address for the -f option field.

Even if you use the classic mailx, I think the local MTA will add a domain anyway, unless configured not to do so. But then you might face the problem, that the eMail will only be transferred inside your own network, as many sites need a proper email address for the sender to detect SPAM. What about:
Code:
echo "Test" | mailx -s "Test subject" reciever@test.com -- -F foobar -f fubar
 
  


Reply


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
shell mail is sending only attachments jlieben Programming 3 08-21-2009 03:44 AM
Sending mail from shell with attached file loopoo Linux - Newbie 1 11-17-2005 04:23 PM
Sending mail from shell with attached file loopoo Linux - General 3 11-17-2005 11:57 AM
Shell script sending mail mfrick Linux - General 5 09-01-2005 08:46 PM
sending mail using shell meshmesh Linux - Software 1 01-25-2004 08:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:28 AM.

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