0

I wrote the following code for sending email to my E-mail address from my site.

But it doesn't work.

I used the following HTML Form in the contact page in my site.

<?php

if(isset($_POST['submit'])) {
        $to ="amishaharali@gmail.com";
        $subject = "E-mail from Ushar Alo Contact Person";
        $txt = $_POST['comment']." -by :".$_POST['mail'];


$headers = "From: msalipbl@gmail.com";

        if(mail($to,$subject,$txt,$headers)){
                echo "Successfully sent!";
                }else{
                echo " Sorry! a problem to send the E-mail!";
                }

}else{


?>
        <hr/>

        <h3>Send e-mail to the Administrator :</h3>

        <form action="http://usharalo.eu.pn/contact.php" method="post">
        Name:<br>
        <input type="text" name="name"><br>
        E-mail:<br>
        <input type="text" name="mail"><br>
        Comment:<br>
        <input type="text" name="comment" size="50"><br><br>
        <input type="submit" name ="submit" value="Send">
        <input type="reset" name="reset" value="Reset">
        </form>

<?php } ?>
msali
  • 1
  • 3
  • `From: http://usharalo.eu.pn/contact.php` < that's an invalid MIME header; `From:` must be an email address. – CD001 Apr 28 '17 at 15:42
  • 1
    Possible duplicate of [PHP mail form doesn't complete sending e-mail](http://stackoverflow.com/questions/24644436/php-mail-form-doesnt-complete-sending-e-mail) – Qirel Apr 28 '17 at 16:22
  • server could be blocking plain mail() calls - you may need to use SMTP Auth: http://stackoverflow.com/questions/24644436/php-mail-form-doesnt-complete-sending-e-mail#answer-24644685 – Picard Apr 28 '17 at 19:52

0 Answers0