how to sendmail using mailx in linux


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers how to sendmail using mailx in linux
# 1  
Old 09-03-2012
how to sendmail using mailx in linux

how to sendmail to other computer in the same computer lab using mailx?
# 2  
Old 09-03-2012
Supposing you have only a text-message to send (no multipart MIME message):

Code:
<stream with message body> | mail -s <subject> <recipient>

for instance:

Code:
$ cat > msgtext
blabla
foo
bar

$ cat msgtext | mail -s "This is a test" foo@bar.com

I hope this helps.

bakunin
# 3  
Old 09-03-2012
mail will read stdin, so, slightly adapting bakunin's example,
Code:
mail -s "This is a test" foo@bar.com

will wait for you typing some text up to a closing dot or <ctrl>D. If you want to send an existing text file, follow bakunin's suggestion. For attachments etc, see the man page.
# 4  
Old 09-03-2012
i already did it...but where did i should see the result? because when i write:
Code:
[physicslab@moon ~]$ mail -s "This is a test" nur_nuha1405@yahoo.com
i like porridge
then ^D

after that i look at the email i sent but no new message inbox...

Moderator's Comments:
Mod Comment edit by bakunin: Please use code tags next time for your code and data.

Last edited by bakunin; 09-03-2012 at 05:38 AM..
# 5  
Old 09-03-2012
If you have permission to do so, have a look into the /var/log directory. Depending on your setup, mail may have its individual logfile(s) like /var/log/mail.* or will report into e.g. /var/log/messages or so. Analysing those files, you will find what happened to your mail.
# 6  
Old 09-03-2012
It might help you understanding the overall process of sending/receiving mail to read this little introduction i wrote.

I hope this helps.

bakunin
# 7  
Old 09-03-2012
i want to sendmail to my friend computer in computer lab and i type this one :
Code:
[ali@marikh ~]$ mail siti@utarid

and its come out like this:
Code:
Subject: ok
testing
EOT

then,i type
Code:
mail

, and its come out this one:
Code:
No mail for ali

---------- Post updated at 04:42 AM ---------- Previous update was at 04:29 AM ----------

when i want to sendmail to myself, i type:
Code:
[ali@marikh ~]$ mail user1
Subject: testing
this is testing
EOT

after i <ctrl>D,its come out:
Code:
[ali@marikh ~]$ /home/ali/dead.letter... Saved message in /home/ali/dead.letter

the content of the dead letter is:

Code:
From ali Mon Sep  3 17:30:15 2012
Return-Path: <ali>
Received: (from ali@localhost)
    by marikh.physic.uk.edu.my (8.14.4/8.14.4/Submit) id q839UFSZ005631
    for user1; Mon, 3 Sep 2012 17:30:15 +0800
From: ali <ali>
Message-Id: <201209030930.q839UFSZ005631@marikh.physic.uk.edu.my>
Date: Mon, 03 Sep 2012 17:30:15 +0800
To: user1
Subject: testing
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

this is testing

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Mailx , sendmail and mailhost

Hi all, I am trying to grasp the concept between the 3 entity above. I understand that mailx - MUA I also understand that sendmail = MTA 1) If I have a centralized mail server (which might not be sendmail), can I just set mailhost in "/etc/hosts" to point to that mailserver and use... (7 Replies)
Discussion started by: javanoob
7 Replies

2. UNIX for Advanced & Expert Users

mailx Vs sendmail to send internal emails to exchange

Hi Gurus, I have been searching for this around, but sendmail seems complicated and not sure if "mail" command would do, since all what I need to send internal emails from my solaris 10 box to our exchange server. Would the mailx or mail command do ? I tried the : # mailx -s test... (2 Replies)
Discussion started by: aladdin
2 Replies

3. Solaris

mailx/sendmail configuration/set up problem

Hello Good People of Linux World!!! Background: Recent Networking Graduate, thrown in line of fire. For the past couple of days I have been searching online for answers and haven't gotten anywhere regarding Mailx, Sendmail functionality on SunOS 5.9. My dilemma: Mailx / sendmail are... (28 Replies)
Discussion started by: kazmiM
28 Replies

4. Solaris

Configure mailx or sendmail

hi, I would like to configure mailx or sendmail to send out some mails to some users. I tried searching online for the configuration but it was kinda confusing. I thought that posting here might get someone to work with me step by step I tried sending out mail but i did not receive in my... (4 Replies)
Discussion started by: cghcgh
4 Replies

5. UNIX for Dummies Questions & Answers

Difference between mail,mailx,sendmail

Hello friends I need to know the difference between mail,mailx and sendmail commands. Thanks in advance (1 Reply)
Discussion started by: rocker
1 Replies

6. UNIX for Dummies Questions & Answers

Sendmail? Mailx? SMTP?

We require e-mails to come from one of our Solaris 10 boxes ASAP and have found that when using such things as Sendmail and Mailx all the mail goes to a Q that only fires every 15 minutes. We have tried everything we could think of to adjust this to force the Q to go every 1 minute but so far no... (3 Replies)
Discussion started by: LRoberts
3 Replies

7. UNIX for Dummies Questions & Answers

Remove certain headers using mailx or sendmail

Hello, So i want to send mails in any way from a solaris 5.8 system, perhaps using mailx or sendmail. My purpose is to stay clear of systems name in head data. So i want to strip at least the "Message-Id" and the "Recieved" headers of the mail. Yet this seems to be a bit of a problem. Now i... (2 Replies)
Discussion started by: congo
2 Replies

8. UNIX for Dummies Questions & Answers

get rid of certain tags with mailx or sendmail

Hello, So i want to get rid of "X-Authentication-Warning" when sending out mails with modified returnadress/senderadress ie. when executing "cat test.email | mailx -t -r me@www.tld" (in test.email theres given To, Subject and textmailcontent") - yet it says "UNIXUSER set sender to... (2 Replies)
Discussion started by: congo
2 Replies

9. UNIX for Dummies Questions & Answers

Postfix Problem under mailx/sendmail command

Update: Problem solved with this command: /opt/soc/bin/postfix-setup ================================ Hi, I am trying the following mailx command: sadm@edwardwi-z:/etc$ mailx ewijaya@gmail.com Subject: test foo . . EOT But it gives the following error ... (0 Replies)
Discussion started by: monkfan
0 Replies

10. UNIX for Dummies Questions & Answers

EXIT STATUS on mailx/sendmail

Hi there I am using mailx command to send mails. I want to send some important files to team members and wud like to know if the team member has recd my email or not. How can I achieve this ? Currently my piece of code is uuencode ${FILE_NAME} ${FILE_NAME} >> mail_msg.txt mailx -s"test... (5 Replies)
Discussion started by: Amruta Pitkar
5 Replies
Login or Register to Ask a Question