Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

mailx issue

Posted on 2015-01-08
9
118 Views
Last Modified: 2015-01-09
Hi All
    i use mailx to send email, now, i run echo "test send" | mailx -s "biaoti" 1324514@qq.com on my linux, i can get the email, but when i run mailx -s "test from shell" 1324514@qq.com, it will stopping, please see an attachment, i can only ctrl+C to cancel it. i would like to use mailx to send a file to my email, how can i do?
mailx-issue.jpg
0
Comment
Question by:beardog1113
  • 3
  • 2
  • 2
  • +1
9 Comments
 
LVL 77

Expert Comment

by:arnold
ID: 40539477
In your first attempt
Test send is the message this is the echo "test send"


On your second attempt, mailx tells you ok, what is the message. When done hit ctrl-D to indicate you are done with the message, EOF.
0
 
LVL 77

Expert Comment

by:arnold
ID: 40539484
Mailx is an email client.

If you detail what it is you are trying to and in what context you want email messages sent, there might be suggestion to better and straight forward to send out messages from scripts or based certain parameters when met.
0
 
LVL 48

Expert Comment

by:Tintin
ID: 40539485
In your second attempt, you are killing mailx rather than giving it some text.


Add your text, then either do:

ctrl-D

or a dot followed by a blank line.
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 23

Expert Comment

by:savone
ID: 40539519
As stated above you need to tell mailx what the message is.  You can do this using redirection, or echo and I am sure there are other ways.

Using redirection:

mail -s "TEST MESSAGE" 1324514@qq.com < /path/to/textfile
0
 

Author Comment

by:beardog1113
ID: 40539522
[root@localhost ~]# mailx -s "Monitor Report att" -a /usr/local/nagios/var/nagios.log 1324514@q            q.com
EOT
Null message body; hope that's ok
[root@localhost ~]#

i have file nagios.log on my linux disk, i would like to use mailx to send this file to my email 1324514@qq.com, i run above command, after i press ctrl+D, is show me the message "Null message body"; hope that 's ok, and i can get the email. but if i do not press ctrl+D, seems the command will keeping running.
any idea?
0
 
LVL 23

Accepted Solution

by:
savone earned 500 total points
ID: 40539526
Yes, redirect the log file like so:

mailx -s "Monitor Report att" 1324514@qq.com < /usr/local/nagios/var/nagios.log
0
 
LVL 48

Expert Comment

by:Tintin
ID: 40539527
or do

echo | mailx -s "Monitor Report att" -a /usr/local/nagios/var/nagios.log 1324514@qq.com
0
 

Author Comment

by:beardog1113
ID: 40539529
mailx -s "KEER Server Monitor Report" -a /usr/local/nagios/var/nagios.log 1324514@qq.com < /usr/local/nagios/var/emailcontent.log

thank you i change the command as above, because i would like send nagios.log as an attachment not email contant, i also create new file emailcontent.log, write some text in the file like "please see an attachment". now my question is, the email content can not support Chinese, any idea?
0
 
LVL 77

Expert Comment

by:arnold
ID: 40539538
There are better email clients such as mutt and pine That can be sued on the command line and are more versatile.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Weird Samba Connectivity Issue... 7 52
Ubuntu Apache Webserver - File Permissions 5 59
Recover Lacie Edmini data. 11 55
Linux MD5 Hash 7 41
Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question