Sponsored Content
Operating Systems Linux Red Hat Problems sending mail: Difference between Mail and Mailx? Post 302850391 by RedSpyder on Wednesday 4th of September 2013 03:31:11 PM
Old 09-04-2013
Problems sending mail: Difference between Mail and Mailx?

Whats the difference between mail and mailx?

I'm trying to troubleshoot a problem where I can send mail from server A with this
Code:
`echo $MESSAGE | mail -s "$SUBJECT" -r $FROM $RECIPIENTS`

command but executing the same command from server B throws me this error (Both servers are RHEL)

Code:
    mail: invalid option -- r
    Usage: mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr ...
                [-- sendmail-options ...]
           mail [-iInNv] -f [name]
           mail [-iInNv] [-u user]

Now... going through mail manpages to ty to understand whats happening, `man mail` gives me this:

In Server A

Code:
    MAILX(1)                         User Commands                        MAILX(1)
    
    NAME
           mailx - send and receive Internet mail
    
    SYNOPSIS
           mailx [-BDdEFintv~] [-s subject] [-a attachment ] [-c cc-addr] [-b bcc-addr] [-r from-addr] [-h hops]
                  [-A account] [-S variable[=value]] to-addr . . .
           mailx [-BDdeEHiInNRv~] [-T name] [-A account] [-S variable[=value]] -f [name]
           mailx [-BDdeEinNRv~] [-A account] [-S variable[=value]] [-u user]


But in server B

Code:
    MAIL(1)                   BSD General Commands Manual                  MAIL(1)
    
    NAME
         mail - send and receive mail
    
    SYNOPSIS
         mail [-iInv] [-s subject] [-c cc-addr] [-b bcc-addr] to-addr... [-- sendmail-options...]
         mail [-iInNv] -f [name]
         mail [-iInNv] [-u user]

Now... if I try `man mailx` in server B I get:

Code:
  MAILX(P)                   POSIX Programmerâs Manual                  MAILX(P)
    
    PROLOG
           This manual page is part of the POSIX Programmerâs Manual.  The Linux implementation of this interface may differ
           (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not  be  imple-
           mented on Linux.
    
    NAME
           mailx - process messages
    
    SYNOPSIS
       Send Mode
                  mailx [-s subject] address...
    
       Receive Mode
                  mailx -e
    
                  mailx [-HiNn][-F][-u user]
    
                  mailx -f[-HiNn][-F][file]

Server B has a different version of mail than Server A? Mailx and Mail are different things? I would like to use the -r option I use in server A but in server B and I don't really know whats happening.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Problems sending Mail

Hello everybody I already read all the posts about "how to send email" but i dont find the solution, i need to send a mail via commands. Into the mail i need to attach a file.txt how can i do that? Thanx. Lestat (2 Replies)
Discussion started by: Lestat
2 Replies

2. Shell Programming and Scripting

sending mail through mailx

while trying to send a mail, though the output file doesn't contain any exclamatory mark(!), i am getting that in the mail with an extra line. please help me out from this ASAP. (3 Replies)
Discussion started by: pvamsikr
3 Replies

3. UNIX for Dummies Questions & Answers

sending mail using mailx command

Hi All, Please help me regarding sending mails using mailx command in unix. I will be glad if some one give me the sintax of this. I tried using the below but vain. mailx -s 'Hi' 'xyz@abc.com' Regards, Manas (5 Replies)
Discussion started by: manas6
5 Replies

4. 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

5. Shell Programming and Scripting

sending mail from perl using mailx

hi All, i am trying to send a mail from perl using mailx. the script runs fine if i hard code the file path which is to be attached to the mail. but when i give a variable containing the path of the file , perl is not able to send the file. ex: system('uuencode /attach/test.txt... (3 Replies)
Discussion started by: adityamahi
3 Replies

6. UNIX for Advanced & Expert Users

Sendmail problems -- with sending mail

Hello, I am C. and I would like to send mail with Sendmail to my hotmail-account. But this doesn't work, the mail always returns in the file: /var/spool/mail/root. Probably there is something wrong with my SmartHost. I configured it like: define ( 'SMART_HOST','smtp.direct-adsl.be') -->... (1 Reply)
Discussion started by: caroline
1 Replies

7. Shell Programming and Scripting

sending mail using Mailx with data from oracle table

Hi, i need to send emails to the mail ids i receive using the sql query . SELECT L.ALARM_DEF,L.CRITERIA,L.DISTANCE_METRE,L.EMAIL,L.LAC_ID,L.LAST_CHECK,L.RANGE, L.RESOURCE_MSISDN,LM.ADDRESS,LM.NAME FROM LANDMARK_ALARM_CONF l, LANDMARK lm WHERE L.LANDMARK_ID=LM.LANDMARK_ID AND... (0 Replies)
Discussion started by: aemunathan
0 Replies

8. Shell Programming and Scripting

sending mail through mailx command

Hi I need help to send mail through mailx command . Currenlt my program is like #!/bin/ksh -x echo " " >> path.lst MAIL_LIST='someone1@gamil.com someone2@gamil.com someone3@gamil.com' cat path.lst | mailx -s "path loaction" $MAIL_LIST echo "End" exit 0 Its work fine . But i... (3 Replies)
Discussion started by: mani_isha
3 Replies

9. Shell Programming and Scripting

mailx -s not sending the file to mail address

Hi All, OS:Red Hat Linux 4 86x64 Below is my shell script which is not sending mail to the mail recipient: #!/bin/bash export MAILLIST="xyz@yahoo.com" cd <path_to_the_script_perf_report.sql> sqlplus / as sysdba @perf_report.sql if then cat <path_to_the_script/*MONTHLY*REPORT*.lst... (6 Replies)
Discussion started by: a1_win
6 Replies

10. UNIX for Dummies Questions & Answers

Mailx working but not sending mail

Hi All, I have a unix server on which mailx is configured . Earlier i was getting proper mails but now some mails are getting stuck and i am not receiving the emails from the server. I can see the mails in mailq. Can you please help me with this . How can i receive these emails? (2 Replies)
Discussion started by: pratikm23
2 Replies
MHMAIL(1)                                                            [nmh-1.5]                                                           MHMAIL(1)

NAME
mhmail - send or read mail SYNOPSIS
mhmail [addrs ...] [-body text] [-cc addrs ...] [-from addr] [-subject subject] [-version] [-help] DESCRIPTION
mhmail is intended as a replacement for the standard Berkeley mail program (mail or mailx), which is compatible with nmh. This program is intended for the use of programs such as cron, which expect to send mail automatically to various users. It is also used by various nmh commands to mail various error notifications. Although mhmail can be used interactively, it is recommended that comp and send be used instead to send messages. When invoked without arguments, it simply invokes inc to incorporate new messages from the user's maildrop. When one or more users is specified, a message is read from the standard input and spooled to a temporary file. mhmail then invokes post with the name of the tempo- rary file as its argument to deliver the message to the specified user. The -subject subject switch can be used to specify the "Subject:" field of the message. By default, mhmail will read the message to be sent from the standard input. You can specify the text of the message at the command line with the -body text switch. If the standard input has zero length, mhmail will not send the message. You can use the switch -body "" to force an empty message. Normally, addresses appearing as arguments are put in the "To:" field. If the -cc switch is used, all addresses following it are placed in the "cc:" field. By using -from addr, you can specify the "From:" header of the draft. Naturally, post will fill-in the "Sender:" header correctly. FILES
/usr/bin/mh/inc Program to incorporate maildrop into folder /usr/lib/mh/post Program to deliver a message /tmp/mhmail* Temporary copy of message SEE ALSO
inc(1), post(8) DEFAULTS
None CONTEXT
If inc is invoked, then inc's context changes occur. MH.6.8 11 June 2012 MHMAIL(1)
All times are GMT -4. The time now is 11:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy