Thanks, Vinod, for advising on both issues. I knew that the code looked like a jumble, but I didn't stop to think about it. Next time I'll make sure that it's legible.
I did what you said to sendmail, and it worked like a charm. I really wish that I had asked for help a week ago!
thanks again!