Jump to content

Problem with mail form...


nysmenu

Recommended Posts

Hi, I was wondering if someone can help me please. I have this form set up called "contact" and the sending script is sending e-mails into my inbox but, it's not posting any information. Would someone please advice on what I'm doing wrong? Thanks.

 

Here's the form:

<form id="form1" name="form1" method="post" action="testing.php">
      <table width="552" border="0" align="left">
        <tr>
          <th width="110" align="left" scope="col">Name:</th>
          <th width="432" align="left" scope="col"><label for="name"></label>
            <label for="name4"></label>
            <input name="name" type="text" class="name1" id="name4" />
            <label for="name2"></label></th>
        </tr>
        <tr>
          <th align="left" scope="col">Last name:</th>
          <th align="left" scope="col"><label for="lname"></label>
          <input name="lname" type="text" class="lname" id="lname" /></th>
        </tr>
        <tr>
          <th align="left" scope="col">E-mail:</th>
          <th align="left" scope="col"><label for="email"></label>
          <input name="email" type="text" class="email" id="email" /></th>
        </tr>
        <tr>
          <th align="left" scope="col">School:</th>
          <th align="left" scope="col"><label for="school"></label>
          <input name="school" type="text" class="school" id="school" /></th>
        </tr>
        <tr>
          <th align="left" scope="col">Message:</th>
          <th align="left" scope="col"><label for="message"></label>
          <textarea name="message" cols="45" rows="5" class="message" id="message"></textarea></th>
        </tr>
        <tr>
          <th align="left" scope="col">Insert code ></th>
          <th align="left" scope="col"><table width="414" border="0" cellspacing="5">
            <tr>
              <th width="52" align="left" scope="col"><img id="captcha" src="securimage/securimage_show.php" alt="CAPTCHA Image" /> </th>
              <th width="117" align="left" valign="bottom" scope="col"><input name="captcha_code" type="text" class="captcha" size="15" maxlength="6" /> </th>
              <th width="219" align="left" scope="col"><a href="#" onclick="document.getElementById('captcha').src = 'securimage/securimage_show.php?' + Math.random(); return false">Reload Image</a> </th>
            </tr>
          </table></th>
        </tr>
        <tr>
          <th align="left" scope="col"> </th>
          <th align="left" scope="col"><label for="submit"></label>
          <input type="submit" name="submit" id="submit" value="Submit" /></th>
        </tr>
      </table>
    </form>

 

and here's the sendingscript:

 

<?php
// Where to redirect after form is processed.
$url = 'http://www.car4students.com/contact.php';

require("class.phpmailer.php");
$mail = new PHPMailer();$mail = new PHPMailer();
$mail->CharSet ="utf-8"; // You can adjust the Charset according to your language
$mail->IsSMTP();
$mail->Host = "mail.car4students.com";
$mail->From="info@car4students.com"; //REMEMBER, this MUST be same as your authorization email address above.
$mail->FromName="Contact Page";
$mail->SMTPAuth = true;
$mail->Username = "info@car4students.com";
$mail->Password = "pass";

$mail->AddAddress("info@car4students.com");
$mail->name="louie";
$mail->subject = "Test 1";
$mail->body = "Test 1 of PHPMailer.";



if(!$mail->Send())
{
   echo "Error sending: " . $mail->ErrorInfo;;
}
else
{
   echo "E-mail sent";
   echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
}?>

 

Notice, I removed the captcha feature from the sending script as it is not a part of the script. Thanks

Link to comment
Share on other sites

Couldn't you try something really simple like

$to = "recipient@example.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
  echo("<p>Message successfully sent!</p>");
} else {
  echo("<p>Message delivery failed...</p>");
}

 

Don't forget that some servers won't see that variables as $email when posted via a form

try either using $_POST['email'] or

 

$email = $_POST['email']; //Then you can use the $email variable.

 

Hope this helps.

 

Link to comment
Share on other sites

Thanks L. I tried it and this is what I get:

 

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\hosting\member\car4students\c4site\test.php on line 27

 

Message delivery failed...

Error sending: You must provide at least one mailer is not supported.

Link to comment
Share on other sites

Hi L or anyone else, I spoke to my server. (not much help) However, they said I needed to integrate the script to work with the contact page. My problem is that I'm fairly new to this and there are some things I just don't understand still. This is the first time using a server that requires SMTP auth. Would you be so kind and point me in the right direction? I have been fighting with this thing for 2 days already. Thank you.

 

this is what I did:

 

<?php
$to = "info@car4students.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $message, $email)) {
  echo("<p>Message successfully sent!</p>");
} else {
  echo("<p>Message delivery failed...</p>");
}
?>
<?php
require("class.phpmailer.php");
$mail = new PHPMailer();$mail = new PHPMailer();
$mail->CharSet ="utf-8"; // You can adjust the Charset according to your language
$mail->IsSMTP();
$mail->Host = "mail.car4students.com";
$mail->From="sales@car4students.com"; //REMEMBER, this MUST be same as your authorization email address above.
$mail->FromName="My site's mailer";
$mail->SMTPAuth = true;
$mail->Username = "info@car4students.com";
$mail->Password = "pass";
?>

Link to comment
Share on other sites

And this is what I keep getting:

 

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\hosting\member\car4students\c4site\testing.php on line 12

 

Message delivery failed...

 

Link to comment
Share on other sites

Hi yes wamp is an option. Clearly your not running that.

To be honest if you host is not being too helpful ask their support

guys to give you some documentation on the subject.

 

You can check your

php ini file really easily. Google php.ini and choose the entry from php.net.  Shows you how to do it there

 

only one line.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.