Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem when handling incoming email by script

Status
Not open for further replies.

volcano

Programmer
Aug 29, 2000
136
HK
Hi my problem is that my Solaris server will receive emails from another Lotus Notes mail server. It will send the emails to the .forward of an email account. The .forward will then call another UNIX script to process the emails. One day I found that if an email contains ".-" (exclude double quotes" characters t end of line and then a line break in the subject, when my script reads that line, the program seems to hang up and occupies almost all CPU. I tried to replace those characters when reading lines but in vain. The general code of the script is as follows:
-----------------------------------------
#!/bin/ksh

LOGS=/export/home/ewp01/maillog/`date +"%Y%m%d_%H%M%S_"`.log

while read -r `echo line|sed "s/\.\-/\.\-/g"`
do
line2=`echo $line | sed "s/\.\-/\.\-/g"`
print -r $line2 >> $LOGS
## business logic ##
done
## business logic ##
------------------------------------------
Do you encounter such strange problem?
 
Sorry, some typo errors... below is correct one

Hi my problem is that my Solaris server will receive emails from another Lotus Notes mail server. It will send the emails to the .forward of an email account. The .forward will then call another UNIX script to process the emails. One day I found that if an email contains ".-" (exclude double quotes) characters at end of line and then a line break in the subject, when my script reads that line, the program seems to hang up and occupies almost all CPU. I tried to replace those characters when reading lines but in vain. The general code of the script is as follows:
-----------------------------------------
#!/bin/ksh

line2=""
LOGS=/export/home/ewp01/maillog/`date +"%Y%m%d_%H%M%S_"`.log

while read -r `echo line|sed "s/\.\-/\.\-/g"`
do
line2=`echo $line | sed "s/\.\-/\.\-/g"`
print -r $line2 >> $LOGS
## business logic ##
done
## business logic ##
------------------------------------------
Do you encounter such strange problem?
 
I don't understand what you're trying to do here:

[tt]while read -r `echo line|sed "s/\.\-/\.\-/g"`[/tt]

Shouldn't that just be:

[tt]while read -r line[/tt]

Maybe that was just a typo in your post?

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top