PDA

View Full Version : Problem with mail form...


gigiloumill
08-16-2009, 03:30 PM
Hey guys, Can someone please tell me what's wrong with this form? It sends e-mails back but it's not displaying any info. Thanks.

<?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="mail@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->Subject = "Subject";
$mail->message = "message";
$mail->email = "email";

include_once $_SERVER['DOCUMENT'] .'d:\hosting\member/car4students\c4site\securimage\securimage.php';

$securimage = new Securimage();

if ($securimage->check($_POST['captcha_code']) == false) {
// the code was incorrect
// handle the error accordingly with your other error checking

// or you can do something really basic like this
die('Oops. The code you entered was incorrect. Please go back and try again.');
}

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

gigiloumill
08-17-2009, 04:16 PM
anybody....?

mangofreak
08-17-2009, 05:27 PM
what kind of error do you receive?

is the following the right path?
d:\hosting\member/car4students\c4site\securimage\securimage.php

gigiloumill
08-17-2009, 06:15 PM
what kind of error do you receive?

is the following the right path?
d:\hosting\member/car4students\c4site\securimage\securimage.php

Yes. I redid the script and now I'm getting this error:

Warning: mail() [function.mail (http://car4students.com/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

Here's the script:
<?php
$to = "info@car4students.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>");
}
?>
<?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";
?>

mangofreak
08-17-2009, 07:23 PM
Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini

Did you setup your smtp?

Google this: Failed to connect to mailserver at "localhost" port 25

and you'll find many possible solutions.

Is this your first time trying to send email this way? were you successful before?

What system are you using? I have Ubuntu running and Apache-php-mysql. Are you using windows?

gigiloumill
08-17-2009, 07:31 PM
I'm using win. I have PHP -mysql. I'm using a new remote server that requires SMTP auth to send e-mail. I never had this problem before. I'm not testing this on my local server, I uploaded files to remote server and testing live. I can't seem to get info from contact form into inbox. I'm seeing an email but it's empty.

mangofreak
08-17-2009, 08:40 PM
How did you generate the mail processing code? what was the application or did you hard code it?

Did you use SmarterMail? if so: check this out:

http://www.smartertools.com/forums/p/12493/26794.aspx

gigiloumill
08-17-2009, 09:43 PM
Thanks mango but, I figured it out. I needed to include all fields posting.

mangofreak
08-18-2009, 12:38 AM
that's great. Cheers.