mailing problem in unix


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting mailing problem in unix
# 1  
Old 11-10-2010
mailing problem in unix

I have a mailing problem in UNIX....
Code:
 
MAILT="$1"
MAILTO=`echo $MAILT | tr ';' ','`
CONTENT="/var/www/html/notifier/mailnotify_ccdb.html"
SUBJECT="$2"
CC="man@abc.com"
BCC="ant@abc.com"
(
 echo "To : ${MAILTO}"
 echo "Cc : ${CC}"
 echo "Subject: $SUBJECT"
 echo "MIME-Version: 1.0"
 echo "Content-Type: text/html"
 echo "Content-Disposition: inline"
 cat $CONTENT
) | /usr/lib/sendmail -f "ht<hn@abc.com>" $MAILTO $CC $BCC

These are the above commands im using to send a mail.
im calling this shell scripts from php file by passing the parameters... the inputs are as follows:
Code:
$1 = 'sug@abc.com;rko@abc.com;nxr@abc.com'    (including the Apastrophe)
$SUBJECT = 'hi to all' (including the Apastrophe)

But im getting error ... because of one email address having Apastrophe in its...
like
Code:
([EMAIL="'joe'conr.suganth@abc.com;sxc@abc.com;sq@abc.com'"]'joe'conr.suganth@abc.com;sxc@abc.com;sq@abc.com'[/EMAIL])

due to this joe'conr (Apastrophe) the mails are not sending it properly .. Please help me ...

Thanks
Ravi

Last edited by Scott; 11-10-2010 at 06:16 PM.. Reason: Code tags, please...
# 2  
Old 11-10-2010
I might be wrong here, but why are you using:

Code:
echo "To : ${MAILTO}"
 echo "Cc : ${CC}"
 echo "Subject: $SUBJECT"

AND also using

Code:
-f "ht<hn@abc.com>" $MAILTO $CC $BCC

I think you want:

Code:
(
 echo "To : ${MAILTO}"
 echo "Cc : ${CC}"
 echo "Subject: $SUBJECT"
 echo "MIME-Version: 1.0"
 echo "Content-Type: text/html"
 echo "Content-Disposition: inline"
 cat $CONTENT
) | /usr/lib/sendmail -t

Notice
Code:
sendmail -t

# 3  
Old 11-10-2010
hi .. i use the -f "ht<hn@abc.com>" code to set .. who is the sender fo this message ...

and my questions is .. i couldnt escape the ( ' ) in the code ..

$1 = 'sug.O\'con@abc.com;rko@abc.com;nxr@abc.com'

i use \ to escape but still giving error .. please help me ,...
# 4  
Old 11-10-2010
Try escaping the apostrophe with a backslash.

Code:
'joe\'conr.suganth@abc.com;sxc@abc.com;sq@abc.com'

Which, bearing in mind our crossed posts was not a good idea.

Next try THREE backslashes.

Code:
'joe\\\'conr.suganth@abc.com;sxc@abc.com;sq@abc.com'

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need syntax for mailing in UNIX by using html file as body and along with attachment

Hi All, I need a syntax for mailing in unix by using html code file output as body and along with attachment (without using mutt command) HTML code file : html1.txt Attachment : attach1.txt I was using the below codes but they are not working. ( cat html1.txt ; uuencode attach1.txt... (4 Replies)
Discussion started by: Rokkesh
4 Replies

2. UNIX for Dummies Questions & Answers

Mailing file from UNIX/bash

I have a file that I want to mail out. However, I cannot get the date to print on it. I've tried the following: /usr/bin/mail -s "Lists on `date`" myname@company.com</tmp/list /usr/bin/mail -s "Lists on $(date)" myname@compancy.com</tmp/list $subj="Lists on $(date)" /usr/bin/mail -s... (3 Replies)
Discussion started by: newbie2010
3 Replies

3. UNIX for Dummies Questions & Answers

Mailing in unix

is there any option to mail the value from top command directly to the user.. i want the value of cpu usage from six different servers to be send in a single mail.. thanks, Arun Manas:b: (3 Replies)
Discussion started by: arunmanas
3 Replies

4. Shell Programming and Scripting

Mailing script

Hi, I have a file lets say FILE1. FILE1 ------ name,age charlie,25 harry,29 david,32 Pls help me writing a mailing script.... which will mail the content of file in the body of the mail & it will look something like below in two columns. name age charlie 25 harry 29... (1 Reply)
Discussion started by: 46019
1 Replies

5. UNIX for Advanced & Expert Users

problem mailing HTML code in cron file.

Hi All, I have written a script which sends mail using “sendmail” command and mail contains HTML code. When I run scripts on terminal it is working properly, but when I try to run this script through a crontab file it sends blank mail with proper subject. crontab file detail : 00 05... (1 Reply)
Discussion started by: abhishek.mind
1 Replies

6. Shell Programming and Scripting

Mailing Problem

I have a Unix server with SunOS 5.8 installed on it. I have set a cron job which will send mail across the two different networks. As of now i can only send mails to the abc.com who owns the server but would also like to send it to xyz.com is there any setting or parameter wherein i need to add... (2 Replies)
Discussion started by: nimish
2 Replies

7. UNIX for Dummies Questions & Answers

Mailing an attachment

Hi, I need to compress (zip) a flat file and mail the same as an attachment. I had tried the following piece of code. But when i open the attachment in mail, the data is incorrect (displays all junk characters). tar cf abc.tar abc.txt compress abc.tar uuencode abc.tar.Z abc1.wri | mailx... (4 Replies)
Discussion started by: gayath3
4 Replies

8. UNIX for Dummies Questions & Answers

mailing from unix -> exchange

Hello, I want to mail from Unix 4.3 (on an RS/6000) to my Microsoft exchange server (5.5). When I trie : mail -v erikr@domain.nl < /directory/file I get the following error: ^Cserverone:/etc >WARNING: The local host name (serverone) does not have a domain; fix$jnconfig ... (7 Replies)
Discussion started by: Erik Rooijmans
7 Replies

9. UNIX for Advanced & Expert Users

Mailing thru UNIX shell script

Hi, I need to send an email from an UNIX shell script along with an attachment. I am working on an HP-UX 11.00 system. The only mailing program which provides adding an attachment to a mail is "pine". However pine is not installed on my system and I cannot install it too due to the server being a... (2 Replies)
Discussion started by: navin
2 Replies

10. UNIX for Dummies Questions & Answers

Mailing an attachment

Hi, I'm fairly new to using Unix and I was just wondering can someone please tell me the simplest way to mail and attachement using the mail command using Solaris? I have tried using uuencode file name | mail johndoe@ttp.ie but it hasn't worked. I have been mailing the file to myself using... (4 Replies)
Discussion started by: gerwhelan
4 Replies
Login or Register to Ask a Question