Non riesco a capire perche' questa funzione che ho scritto per le mail non funziona qualcuno mi puo aiutare?

Codice PHP:

function mail($mittente,$mailMittente,$mailDestinatario,$oggetto,$messaggioTxt,$htm=''){
$n='\n';
        
$boundary '==Boundary_'md5(time()).'x';
        
$header '';
        
$header .= 'From: ' $mittente '<' $mailMittente '>'.$n;
        
$header .= 'Reply-To: ' $mittente '<' $mailMittente '>'.$n;
        
$header .= 'Return-Path: ' $mailMittente.$n;
        
$header .= 'X-Mailer: PHP 5' $n;
        
$header .= 'MIME-Version: 1.0'.$n;
        
$header .= 'Content-Type: multipart/alternative; boundary="' $boundary '"'.$n.$n;
        
$messaggio'not support HTML email!'.$n.$n;
        
$messaggio.='--'.$boundary.$n;
        if(
$htm!=''){
          
$messaggio .= 'Content-Type: text/html; charset="utf-8"' $n;
          
$messaggio .= 'Content-Transfer-Encoding: 8bit' $n $n;
          
$messaggio .= $htm $n$n;
          
$messaggio.='--'.$boundary.$n;
        }
        
$messaggio .= 'Content-Type: text/plain; charset="utf-8"' $n;
        
$messaggio .= 'Content-Transfer-Encoding: 8bit' $n $n;
        
$messaggio .= $messaggioTxt $n.$n;
        
$messaggio .= '--' $boundary '_alt--'.$n;
    
mail($mailDestinatario,'=?UTF-8?B?'.base64_encode($oggetto).'?='$messaggio$header);