Click here to Skip to main content
15,920,688 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am trying to send messages from my website to my email.
the whole idea is that people will be able to send me message from my website

below is the following i have tried

What I have tried:

<?php 

include 'index.php';



$name =  $_POST["name"];
$email =  $_POST["email"];
$number =  $_POST["number"];
$Message = $_POST["Message"];



$to = "sean971@gmail.com";

//sender - from the form
$from = $name . ' <' . $email . '>';
//subject and the html message
$subject = 'Message from ' . $name;
$message = 'Name: ' . $name . '<br/><br/>
      Email: ' . $email . '<br/><br/>
  Phone: ' . $number . '<br/><br/>
      Message: ' . nl2br($Message) . '<br/>';

$result = mail($to, $subject, $message, $from);

if ($result)  {  
          echo "<script> $('#thanksModal').modal('show')</script>";

 } else if (!$result){

     echo 'Sorry, unexpected error. Please try again later';

} 






?>
Posted
Updated 2-Jan-17 20:23pm

1 solution

You did not provide information about your issue. So, i'm guessing that an email is not going to send (no action is taken).

Please check this: PHP: mail - Manual[^]. You have to scroll down the site to the jimmytrojan009 at gmail dot com comment, because you have to made some changes in php.ini and sendmail.ini. The same is stated here: Sending Emails using PHP[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900