Unable to set end of line in mail command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Unable to set end of line in mail command
# 1  
Old 08-13-2012
Unable to set end of line in mail command

Hi ,
Am trying to send mail using the mail command, but the mail command is working but its not sending automatically after pressing .(dot) in the command prompt it sends . How to achieve that. Also it showing the below line after pressing the dot .

Code:
/home/abc1/dead.letter... Saved message in /home/abc1/dead.letter


Code:
if <condition>
mail -s "test mail " abc@xyz.com -c bb@xyz.com
fi


this is the command am trying it sending mail to both to and cc field but I have to enter .(dot) in the command prompt.Need to achieve without doing that.


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

Last edited by zaxxon; 08-13-2012 at 08:22 AM.. Reason: code tags
rogerben
# 2  
Old 08-13-2012
try this..

Code:
if <condition>
mail -s "test mail " "abc@xyz.com" -c "bb@xyz.com" < file
fi

# 3  
Old 08-13-2012
Quote:
Originally Posted by pamu
try this..

Code:
if <condition>
mail -s "test mail " "abc@xyz.com" -c "bb@xyz.com" < file
fi


Hi,
The code which you gave is not working. If I give
Code:
mail -s "test mail " "abc@xyz.com" -c "bb@xyz.com"

i have to press . as usual and if i give
Code:
mail -s "test mail " "abc@xyz.com" -c "bb@xyz.com" < file

its not working and it doesnt shows any error


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

Last edited by zaxxon; 08-13-2012 at 08:23 AM.. Reason: code tags
rogerben
# 4  
Old 08-13-2012
Quote:
Originally Posted by rogerben
Hi,
The code which you gave is not working. If I give
Code:
mail -s "test mail " "abc@xyz.com" -c "bb@xyz.com"

i have to press . as usual and if i give
Code:
mail -s "test mail " "abc@xyz.com" -c "bb@xyz.com" < file

its not working and it doesnt shows any error


Moderator's Comments:
Mod Comment Please use code tags next time for your code and data.
It is working fine that's why it won't show any error...
try to give some real email address and check...
# 5  
Old 08-13-2012
Quote:
Originally Posted by pamu
It is working fine that's why it won't show any error...
try to give some real email address and check...

I tried with real address only and its not sending the mail option. Am getting the file not found error can you pls let me know what is the usage of using "<file" at the end.
Error:
Code:
file: No such file or directory


Last edited by Scott; 08-13-2012 at 09:40 AM.. Reason: Code tags
rogerben
# 6  
Old 08-13-2012
Quote:
Originally Posted by rogerben
I tried with real address only and its not sending the mail option. Am getting the file not found error can you pls let me know what is the usage of using "<file" at the end.
Error:
file: No such file or directory
Create one empty file in the code or add content that you want to send through the mail in that file..
This User Gave Thanks to pamu For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Unable to send mail with 'mail' command

I am unable to cause the 'mail' command to send mail from my linux ubuntu 15.10 computer. File 'mail.log' typically reports Connection timed out. I issue the command: mail -s "my subject" recipient@domain.com < filenamewhere filename is a file containing my message. Specifically, the... (3 Replies)
Discussion started by: tcnm
3 Replies

2. Shell Programming and Scripting

How to add a line to the end of a set of files without using sed command?

I understand that the SED command reads all the lines in the file before adding a required line to the end of the file. Is there another command that adds a line to the end of files without reading the entire file.... SED is increasing the processing time as the number of lines in each of the... (1 Reply)
Discussion started by: Kanch
1 Replies

3. UNIX for Dummies Questions & Answers

Running set options from the command line and bash command

I'm reading about debugging aids in bash and have come across the set command. It says in my little book that an addition to typing set you can also use them "on the command line when running a script..." and it lists this in a small table: set -o option Command Line... (5 Replies)
Discussion started by: Straitsfan
5 Replies

4. UNIX for Dummies Questions & Answers

[SOLVED] Command line mail taking too long to send; unable to qualify my own domain name

Hello, I'm having a problem with my mail. When I send mail, it takes a long time for the send to complete. In the below, datestamp is just a simple script to put in a no-white-space date/time stamp. $ datestamp ; mail woodnt; datestamp 02-05-10@193844 Subject: test timer Cc: ... (0 Replies)
Discussion started by: Narnie
0 Replies

5. Shell Programming and Scripting

Using sed command to change end of line

I am looking to change a data file into a javascript string and this is the code that I am using: sed -i '' -e 's/^/str += "/' -e 's/$/";/' file.xml The first part -e 's/^/str += "/' works as intended, but the second part -e 's/$/";/' adds an additional newline to my file, so that instead of... (3 Replies)
Discussion started by: figaro
3 Replies

6. UNIX for Dummies Questions & Answers

How to set HIGH importance to a mail sent through mailx or sendmail command

I have written a script for sending automated email, reporting the running status of a cron scheduled work. Now, the issue is, my Project Manager wants, the mail should be received with HIGH IMPORTANCE. How can I do that, kindly anybody explain. Thank you so much. (3 Replies)
Discussion started by: mitte_dino
3 Replies

7. UNIX for Dummies Questions & Answers

Unable to send e-mail using mailx command

Hi All, Can you please help me in solving this. I am facing some problem sending mails. If I use like this, I am able to send mail the mail echo "This is an automated e-mail; please do not reply." | mailx -s "Good Morning ." 'abc@xys.com' But if I use like this, then I am unable to send... (1 Reply)
Discussion started by: manas6
1 Replies

8. UNIX for Dummies Questions & Answers

unable to use command line to cd or ls

Hi: I have a script with the next command line >set a=(grep -w "something" textfile.txt | grep -w "anotherthing" | cut -c1-11) In the file textfile.txt there are some file names and their paths so when I use this command line it returns a path, for example /directory, and stores in a. ... (3 Replies)
Discussion started by: bosh
3 Replies

9. UNIX for Advanced & Expert Users

unable to sent mail in html format by mailx command.

I use maix command to sent mails. i can sent only plain text mails. Unable to sent mails in html format. while sending mails in html format, the received mail has the html code only. (17 Replies)
Discussion started by: p_prathaban
17 Replies
Login or Register to Ask a Question