in reply to Sendmail issue

Without getting into the details of sendmail - is there some reason you aren't using one of the many modules available for this task? For example, Mail::Sender - see also How do I send email?