I have hosted my website on my Ubuntu server. I have added an email forum on my website so visitors can send emails to me. But it is not working anymore. Here's the full php code

    $errors = '';
    $myemail ='my@email.com';//<-----Put Your email address here.
    $name = $_POST['name']; 
    $message = $_POST['message'];  

    $to = $myemail; 
    $email_subject = "Contact form submission: $name";
    $email_body = "You have received a new message. ".
    " Here are the details:\n Username: $name \n  $email_address \n Password: \n $message"; 

    $headers = "From: $myemail\n"; 
    $headers .= "Reply-To: $email_address";

    //redirect to the 'thank you' page
    header('Location: example.com/thanks.html');

closed as too broad by John Conde Jun 15 '17 at 17:01

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Where is this Ubuntu server? If it is hosted at home, your ISP likely blocks directly sent outbound mail. In that case you will have to configure your computer as "smarthost". See askubuntu.com/questions/167043/… – Stephen Ostermiller Jun 15 '17 at 16:59
  • It is a VPS in Digital Ocean – Bangladesh 71 Jun 15 '17 at 17:00
  • There are a lot of possible reasons. Find the log files and see what they say. – Stephen Ostermiller Jun 15 '17 at 17:01
  • 1
    This belongs at Stack Overflow but is a very common duplicate question there so I won't migrate it. You can view the canonical question here which contains instructions for debugging this. – John Conde Jun 15 '17 at 17:01

Browse other questions tagged or ask your own question.