Problem using unix mail command


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Problem using unix mail command
# 1  
Old 02-08-2009
Problem using unix mail command

Hello,

When i am using mail command like this:
mail -r prashant.aggarwal@xx.com -s "hiiii" prashant.aggarwal@xx.com < Content.txt i am abl eto dend a mail. Content.txt is a file from which contents are being reda

But when i am trying to execute it thru a shell scipt like this it's giving
The flags you gave make no sense since you're not sending mail. The strange part is still sending the mail to me as desired, why is this message coming?

The shell script is this:

while read line
do
mail -r prashant.aggarwal@xx.com -s "The CBE Alert Processor is not working in Development" $line < Content.txt
done < MailTo.txt

MailTo.txt contains email id's to which i want to send mail. Each id starts from new line

Please guide me where is the problem

Thanks
# 2  
Old 02-08-2009
Perhaps your MailTo.txt file contains a blank line?

Since you can specify multiple email addresses on the command line, why not just:

Code:
 mail -r prashant.aggarwal@xx.com -s "The CBE Alert Processor is not working in Development" $(MailTo.txt) < Content.txt

# 3  
Old 02-09-2009
mail -r
Means READ mail.

Please elaborate on what you are trying to do.
# 4  
Old 02-09-2009
From man mail on SLES 9:
Code:
       -r address
              Sets  the From address. Overrides any from variable
              specified in environment or startup  files.   Tilde
              escapes  are  disabled.  The -r address options are
              passed to the mail transfer agent  unless  SMTP  is
              used.

Not always, it varies (considerably) from OS to OS.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Mail command problem with " signs

Hello, I have compiled a perl script to extract email address from an email file and tried to send email as bash script but " signs are ommitted by the bash script. What am I doing wrong? I would appreciate if you could fix it. #!/bin/bash while read -r COL1 do echo "mail -s "This is a... (3 Replies)
Discussion started by: baris35
3 Replies

2. Shell Programming and Scripting

UNIX mail command

I am using HP-UX server. I tried to send the email with attachment, I used the below unix command to send with attachment but it doent work. uuencode pepsitoday.csv | mailx -s "csv file" ramkumar15@pepsi.com ---------- Post updated at 02:10 AM ---------- Previous update was at... (2 Replies)
Discussion started by: ramkumar15
2 Replies

3. Shell Programming and Scripting

mail command in Unix

Hi All, Is it possible to email a file from another directory in Unix shell prompt? In other words, do we have to be in the directory where the file is located to mail the file? I was in the Mail directory and my file (filename) is in the Practice directory. I tried this and it didn't work:... (7 Replies)
Discussion started by: onlinelearner02
7 Replies

4. UNIX for Dummies Questions & Answers

Problems using Unix mail command (2)

I recently generated myself the following error when attempting to use the Unix mail command: The flags you gave make no sense since you're not sending mail. There is a recent thread about this issue here in unix.com (with a title very much like this thread's title), but it was closed... (2 Replies)
Discussion started by: Clovis_Sangrail
2 Replies

5. UNIX for Dummies Questions & Answers

Unix mail command internals

Hi all , I wanted to know how does a 'mail' command works in unix. Does it use an smtp server internally ? How and where it is configured then ? I am trying to google out the same , but not getting much help. Any suggestions with be of great help. - Andy (5 Replies)
Discussion started by: anindyabecs
5 Replies

6. Ubuntu

problem in linux ubuntu 10.10 about mail command

Hi, My question is that is there any substitute command for mail in ubuntu because I'm trying to run it and it is showing error: command not found!! Will it need to download any specific package? If so please tell me how can I download that pkg. Thanks in advance. (1 Reply)
Discussion started by: nageshgautam
1 Replies

7. Shell Programming and Scripting

Problem with Mailx command to send mail with attachment

Hi, I am using mailx command to send a mail with attachment. It's working fine, but with attachment I am getting one extra attachment like (ATT00131.txt). I have tried to use unix2dos command also. But still I am getting the extra attachment. I am using the following code: subject="temp... (5 Replies)
Discussion started by: viswanatharv
5 Replies

8. UNIX for Dummies Questions & Answers

Mail command in UNIX

1)My main script Calls a function IsDomain to check whether the domain is valid or not PROD>/appl/retek/mpscripts/cat mg3TRn01 #!/bin/ksh # # Standard Header Files # # . ${0%${0##*/}}UKMPFunctionLibrary.test # # START # ScriptStart # # Check that domain exists.Print &... (0 Replies)
Discussion started by: Shilpi
0 Replies

9. UNIX for Dummies Questions & Answers

Problem with Mail command: exec failed. errno=2.

I am trying to send email using the "mail" command. I keep getting an "exec failed. errno=2." message. Here is one the commands I have tried: mail test@mycompany.com < test1.out Any ideas what may be causing this error msg? (1 Reply)
Discussion started by: hawkman2k
1 Replies

10. UNIX for Dummies Questions & Answers

UNIX mail command

hi, Im trying to send a e-mail to two people e.g X & Y . I run a shell script that uses the mail command to send an email to both these people . The email that i am sending contains two attatchments that i 'add' to a .mail file. mail <recipients> < filename.mail The problem that im... (1 Reply)
Discussion started by: nbvcxzdz
1 Replies
Login or Register to Ask a Question