if you really want an attachment you need to get a MUA (Mail User Agent) or a small program (perl with MIME::Lite, etc) to do the job.
sendmail is a MTA (Mail Transfer Agent) and doesn't care for mail content (MIME attachments, etc), but only for delivery.
Code:
## from: http://www.experts-exchange.com/Prog..._20208667.html
use MIME::Lite;
# The rest of script here ...
my $msg = MIME::Lite->new (
From => $your_email,
To => $fields{'membersemailaddress'},
Subject => 'Test Subject',
Type => 'multipart/mixed'
);
$msg->attach(
Type =>'TEXT',
Data =>"Dear $fields{'membersname'},\n\nTEST MESSAGE\n"
);
foreach my $file ( qw(1.gif 2.gif 3.gif) ) {
$msg->attach(
Type => 'image/gif',
Path => "../public/images/$file",
Filename => $file,
Disposition => 'attachment'
);
}
$msg->send;