Subject line of an email


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Subject line of an email
# 1  
Old 12-17-2010
Subject line of an email

Hi all,

I am trying to automate a process in which at the end of the process the script should send an email to the user saying this process is completed.

I have done everything but the problem now is the subject line of the email...

the subject line looks like this..
Quote:
line 1:

REQ_SUBJECT="Email Notification - Requested Process completed - FILE sent to abc xyz"
where abc xyz is a company name which changes for every new process.

if i use the above variable for my subject line while sending email, i'll not get any email.

but..
if i use it as below..
Quote:
line 2:

REQ_SUBJECT="Email_Notification_-_Requested_Process_completed_-_FILE_sent_to_abc_xyz"
it works perfectly fine...

So some one please help me is it not possible to put a subject line with spaces in between?? if yes then is there any way to modify the line 1 using script to replace those spaces into an underscore inside the same file..

PLease help...

Thank you.

Regards,
Deepak.
# 2  
Old 12-17-2010
You haven't posted the code that you use to send the mail. Anyway, you probably just need to add some double quotes, e.g....
Code:
mailx -s "$REQ_SUBJECT"

# 3  
Old 12-17-2010
you are giving that variables without $ symbol.
store those company names in a variables and send like this
REQ_SUBJECT="Email_Notification_-_Requested_Process_completed_-_FILE_sent_to_$abc_$xyz"
# 4  
Old 12-17-2010
To elaborate...

Deepak,

If you define the company name as a variable then you can do something like this:

Code:
COMPANY="abc xyz"
REQ_SUBJECT="Email Notification - Requested Process completed - FILE sent to $COMPANY"
echo "This is an automated email, please do not reply." |mailx -s "$REQ_SUBJECT" email@domain.com

# 5  
Old 12-20-2010
Quote:
Originally Posted by Ygor
You haven't posted the code that you use to send the mail. Anyway, you probably just need to add some double quotes, e.g....
Code:
mailx -s "$REQ_SUBJECT"


Thanks for all your reply... double quotes has solved my issue... Thanks again..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Variable not displaying in subject line of mailx email

Hi Newbie here with first post. I've got a shell script (ksh) whereby I run a SQL*Plus script and output the results to a file. I then check the output file in an if statement that looks like this: if ]; then export GAPNUM=`awk '{print $4}' $OUTFILE` if ] then mailx -s... (10 Replies)
Discussion started by: ltzwoman
10 Replies

2. Shell Programming and Scripting

Sending sql output to email body with conditional subject line

hi , i have written below piece of code to meet the requirement but i am stuck in the logic here. the requirement are: 1) to send the sql out put to email body with proper formatting. 2) if count_matching = Yes then mail should triggered with the subject line ... (10 Replies)
Discussion started by: itzkashi
10 Replies

3. Shell Programming and Scripting

Sendemail how to send an email with a subject variable

Hi,:) I try this : #!/bin/bash sender="me@example.com" recipient="you@example.com" subject="TEST FILE" server="0.0.0.0" file=$(cat file.txt) /usr/bin/sendemail -f $sender -t $recipient -u $subject -m $file My file.txt: BLABLALA BLABLABLA (7 Replies)
Discussion started by: Arnaudh78
7 Replies

4. Shell Programming and Scripting

Getting email output in single line with out space in email

I have tried below email method and i am getting every thing in single line . i have put echo to provide space, but it is not helping my code ( echo "From: $FROM" echo "To: $MAILTO" echo "CC: $CC" echo "Subject: $SUBJECT" echo "MIME-Version: 1.0" echo 'Content-Type: multipart/mixed;... (6 Replies)
Discussion started by: mirwasim
6 Replies

5. Shell Programming and Scripting

help with script to send email and if subject line match is found

Help with script that will check log, then find a match is found, add that as the subject line. 1. The script will always run as a deamon.. and scan the event.log file 2. when a new 101 line is added to the event.log file, have the script check position 5,6 and 7 which is the job name, which... (2 Replies)
Discussion started by: axdelg
2 Replies

6. Shell Programming and Scripting

Unable to populate subject field of the email while using sendmail

Hi, Can anyone kindly provide some information about how to populate the subject field of the email while using the sendmail utility ? Itried the following command line argument : echo -e "Body of the email" | /usr/lib/sendmail -f from@from.com -t to@to.com -s " Subject of the email" ... (4 Replies)
Discussion started by: sdiptanil
4 Replies

7. Shell Programming and Scripting

Run a script based on the subject line of the email

Hi, I need help in running a script that would pull info from an email subject line and run a script (foo.sh). I'm pretty sure after a bit of googling that this is possible in several ways. but none was pretty clear on how to accomplish it. The part that I really need help with is getting the... (5 Replies)
Discussion started by: satekn
5 Replies

8. Gentoo

inserting grep -c value into an email subject

I am profoundly new to *nix, but had a project dropped in my lap that has sparked an interest, leading me here. I was tasked with daily sending one of our customers a listing of all the spam our filter blocked that was heading for them. Between Google and I; I discovered the Server is running... (3 Replies)
Discussion started by: GrendelPrime
3 Replies

9. Shell Programming and Scripting

Email with subject contains value of Variable

I want to email where subject contains value of variable $ORACLE_SID. When script is emailing, it is not taking value of $ORACLE_SID. example - I have variable ORACLE_SID=prd I am sending email with below script. tail -1 $LOG | mailx -s 'Export Completed for ${ORACLE_SID}'... (2 Replies)
Discussion started by: deepsingh
2 Replies

10. UNIX for Advanced & Expert Users

use email subject line as shell command

If anyone can give me some ideas on this it would be great. What I'm trying to do is to have emails be sent to my unix account. Once they are emailed to the unix account, I want to use the text in the subject field to invoke a shell script, so basically I need to find a way that I can... (4 Replies)
Discussion started by: mskarica
4 Replies
Login or Register to Ask a Question