0

I have a simple website with a contact form which sends out an email after the user fills out and clicks on submit, however this doesn't seem to be working,

Unfortunately I don't have access to the mail server itself as it is hosted,

How do I debug this?

<?php
 require_once "Mail.php";

 $from = "B A <[email protected]>";
 $to = "B B <[email protected]>";

    if($subject!=""){
    $subject =$_REQUEST['subject'];
    }else{
    $subject = 'Lighter Contact Form';
    }

    $name=$_REQUEST['name'];
    $email=$_REQUEST['email'];
    $msg=$_REQUEST['msg'];

    $port = "25";

    $body = "Name: $name \n\nEmail: $email \n\nMessage: $msg";
    $headers = 'From: '.$name.' <'.$email.'>' . "\r\n" . 'Reply-To: ' . $email;

 $host = "imap.ox.registrar-servers.com";
 $username = "info@abc";
 $password = "password";


 $smtp = Mail::factory('smtp',
   array ('host' => $host,
     'port' => $port,
     'auth' => true,
     'username' => $username,
     'password' => $password));

 $mail = $smtp->send($to, $headers, $body);
?>
1
  • What logs have you checked? Commented Dec 12, 2013 at 3:09

1 Answer 1

1

You could check for an error response (assuming you are using the Pear Mail class:

if(Pear::isError($mail))
{
    die($mail->getMessage());
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.