LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-26-2011, 11:26 AM   #1
drazenmd
LQ Newbie
 
Registered: Dec 2011
Posts: 6

Rep: Reputation: Disabled
Problem wirh mailx


Hi,
I am trying to send mail from script. When I use this command evyrthing works great

echo "This is a test message" | mailx -s "Test" me@domain.net;

But if I put like this:

$f is name of file which I am reading
var=`cat $f`
echo "$var" | mailx -s "Test" me@domain.net;

it is sending email but without message(without body). I only have subject. If I do echo "$var" I am getting content of file normaly.

If I put "$var" in subject I am getting mail, in subject there is one line of file content and in message body I am getting other line and this text Message-ID: <4ef89fd0.IBaQ8Nx7ioCRAdjo%info@apif.net>
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


Does anyone know what can be problem. Thank's
 
Old 12-27-2011, 05:45 AM   #2
Nermal
Member
 
Registered: Jan 2009
Distribution: Debian
Posts: 59
Blog Entries: 2

Rep: Reputation: 6
You could try:

Code:
cat $f | mailx -s "Subject" user@domain

or:

echo "Here is the file:" | mailx -s "Subject" -a $f user@domain
The first may consider the content and process it as if you are sending it typing it in therefore lines that are ".\n" may break it.

The second will attach the file it will not be processed.
 
  


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
problem wirh qmail server dellxmax Linux - Server 1 11-14-2009 05:22 PM
mailx problem jobleep Slackware 7 11-02-2008 09:29 AM
mailx problem jobleep Slackware 1 10-30-2008 01:15 PM
mailx problem aral SUSE / openSUSE 5 06-01-2008 02:41 PM
Problem wirh baghira aerlinn Linux - Software 2 05-14-2005 12:27 AM


All times are GMT -5. The time now is 07:00 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration