Basically I created a contact form using php, GoDaddy marks most of them as spam, and the server does not even send the email.

So I tried making a smtp contact form and I'm running into some problems.

<?php

$recipients = "receiving email";
$from = "Support <support@domain.com>";
$to  = "Accounts <accounts@domain.com>";
$subject = "Online Authorization Form";


 $host = "smtpoutout.secureserver.net";
 $port = "80";
 $username = "email";
 $password = "password";

 $headers = array ('From' => $from,
   'To' => $to,
   'Subject' => $subject);

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

$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$name = $_POST['name'];
$address = $_POST['address'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$d = $_POST['d'];
$da = $_POST['da'];
$value = $_POST['chk'];
$pname = $_POST['pname'];
$title = $_POST['title'];
$agree = $_POST['agree'];
$employee = $_POST['employee'];

$formcontent=" From: $name \n Address: $address \n Email: $email \n Phone: $phone \n D: $d \n D Address: $da \n 'Client' has read Assignment and Contract Agreement: $value \n Print Name: $pname \n Title: $title \n I hear by agree that the information I have provided is true, accurate and the information I am submitting is not fraudulent. Please click the agree button that you adhere to Commercial Recovery Authority Inc.'s terms: $agree \n \n  Employee ID: $employee \n IP: $ip";

mail = $smtp->send($to, $headers, $formcontent);

echo "Thank You!" . " -" . "<a href='index.php' style='text-decoration:none;color:#ffcb00;'> Return Home</a>";
?>

Getting an error on line 42,

Parse error: syntax error, unexpected '=' in /home/content/c/o/m/commercialrs/html/cra/mailtest.php on line 42

or

mail = $smtp->send($to, $headers, $formcontent);

So basically everything and anything could be wrong. Any suggestions or a better code for this?

    $smtp->send($to, $headers, $formcontent);

    and it came back with

    Fatal error: Class 'Mail' not found in /home/content/c/o/m/commercialrs/html/cra/mailtest.php on line 18

    line 18,

    $smtp = Mail::factory('smtp',

    so it's my smtp code probably.

      as the error says the class Mail does not exist, any class' you use need to be included in your script

        dagon;10975744 wrote:

        as the error says the class Mail does not exist, any class' you use need to be included in your script

        Isn't mail = $smtp->send($to, $headers, $formcontent);

        isn't that the class?

          i would expect an
          include (smtp.php);
          or what ever the file is called.

            dagon;10975833 wrote:

            i would expect an
            include (smtp.php);
            or what ever the file is called.

            So my actual form is client.php, then the code I inserted to the post is mail.php

            where would I include the mail.php?

              Write a Reply...