rdhanek
November 10, 2010, 3:45pm
1
I have a mailing problem in UNIX....
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:
$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
('joe'conr.suganth@abc.com;sxc@abc.com;sq@abc.com')
due to this joe'conr (Apastrophe) the mails are not sending it properly .. Please help me ...
Thanks
Ravi
purdym
November 10, 2010, 4:10pm
2
I might be wrong here, but why are you using:
echo "To : ${MAILTO}"
echo "Cc : ${CC}"
echo "Subject: $SUBJECT"
AND also using
-f "ht<hn@abc.com>" $MAILTO $CC $BCC
I think you want:
(
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
sendmail -t
rdhanek
November 10, 2010, 4:41pm
3
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 ,...
methyl
November 10, 2010, 4:46pm
4
Try escaping the apostrophe with a backslash.
'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.
'joe\\\'conr.suganth@abc.com;sxc@abc.com;sq@abc.com'