PHP has its inbuilt mail function to send
Sometimes PHP's default mail function is not flexible enough to achieve what a developer needs. This is where PHP mailer library becomes more useful.
You can download PHPmailer library from it GIT repository. Here is an example of sending email using it.
<?php require("class.PHPMailer.php"); $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = "mail.oodles.com"; $mail->SMTPAuth = true; $mail->Username = "admin"; // SMTP username $mail->Password = "admin1234"; // SMTP password $mail->From = "[email protected]"; $mail->FromName = "Test Mail"; $mail->AddAddress("[email protected]", "Josh Doe"); $mail->AddAddress("[email protected]"); $mail->AddReplyTo("[email protected]", "Informatic"); $mail->AddAttachment("/tmp/image.jpg", "testImage.jpg");// optional name $mail->IsHTML(true);// set email format to HTML $mail->Subject = "Add your subject here"; $mail->Body = "This is the HTML message body "; $mail->AltBody = "This is the body in plain text for non-HTML mail clients"; if(!$mail->Send()) { echo "Message could not be sent."; echo "Mailer Error: " . $mail->ErrorInfo; exit; } echo "Message has been sent"; ?>