CodeIgniter's URI and form action
As simple example as to give you is to use CI's site_url()
site_url("controller/function")
and it will take care of other url things
<form role="form" method="post" action="<?php echo site_url('mail/sendmail');?>">
Go through url_helper