la mejor forma es PHPMailer como dicen los amigos pero para que funcione bien la funcion mail hay que confirgurar muchas cosas mas.
por ejemplo en el php.ini encontras algo así:
[mail function]
; For Win32 only.
;
http://php.net/smtp
SMTP = localhost
;
http://php.net/smtp-port
smtp_port = 25
; For Win32 only.
;
http://php.net/sendmail-from
sendmail_from = you@yourdomain
aca podes configurar tus datos de smtp , no hace falta poner las contraseñas
te doy el que yo uso, pero adaptalo a tu script:
Código PHP:
Ver original// Para enviar correo HTML, la cabecera Content-type debe definirse
$headers = 'To: '.$this->getFullRecipient() . $eol;
$headers .= 'From: "'.$this->getSenderName().'" <'.$this->getSenderEmail().'> ' . $eol ;
// $headers .= 'Reply-To: '.$this->getSenderEmail() . $eol;
if($this->replyTo != ""){
$headers .= 'Reply-To: ' . $this->replyTo . $eol;
}else{
$headers .= 'Reply-To: '.$this->senderEmail. $eol;
}
$headers .= 'Bcc: '.$this->getBccEmail() . $eol;
$headers .= 'X-Mailer: PHP/' . phpversion(). $eol; $headers .= 'MIME-Version: 1.0' . $eol;
//$headers .= 'MIME-Version: 1.0' . $eol;
if($this->fileAttached){
$headers .= 'Content-Type: multipart/mixed; boundary="'.$this->mime_boundary.'"'.$eol;
}else{
$headers .= 'Content-type: text/html; charset=iso-8859-1'.$eol;
}
$mail_result = mail ($this->getRecipientEmail(), $this->subject, $this->body, $headers,
"-f$this->senderEmail -F".
$this->encode($this->recipientName,'ISO-8859-1'));