Devi usare la classe PHPMailer

Sul sito trovi tutte le informazioni che ti servono.