Try
Mail::Sender. This
is amodule but it doesn't have any XS code so it should install OK in a CGI directory. It doesn't require an installation of sendmail or similar. It connects directly to an SMTP server and appears to do all the things that you want to do. I have only used it for simple text but the docs cover attachments etc.