Php Send Email - Php

How to send an email using Php code?

Snippet Code


  
Rate this page :
  [ 0 votes]

Here, function send_mail($from,$to,$subject,$message) is used to send email. Fill the from, to, subject and message to send the mail.

<?php function send_mail($from,$to,$subject,$message) { $headers ="From:$from<$from>rn"; $headers .= 'MIME-Version: 1.0' . "rn"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn"; if(@mail($to, $subject, $message, $headers)) { return true; } else{ return false; } } $from="from@example.com"; $to="to@example.com"; $subject="Hscripts Mail Sender"; $message="Hello Hscripts.com"; if(send_mail($from,$to,$subject,$message)) { echo "<font color='green'>Mail Sent......</font>"; } else{ echo "<div align=center>Mail Unable to send</div>"; } ?>

Tags


Ask Questions

Ask Question