nysmenu Posted August 17, 2009 Share Posted August 17, 2009 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 Quote Link to comment Share on other sites More sharing options...
Lyleyboy Posted August 17, 2009 Share Posted August 17, 2009 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. Quote Link to comment Share on other sites More sharing options...
nysmenu Posted August 17, 2009 Author Share Posted August 17, 2009 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. Quote Link to comment Share on other sites More sharing options...
Lyleyboy Posted August 17, 2009 Share Posted August 17, 2009 Hmm, Sounds like a problem with the PHP install. I'd speak to your host. Quote Link to comment Share on other sites More sharing options...
nysmenu Posted August 17, 2009 Author Share Posted August 17, 2009 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"; ?> Quote Link to comment Share on other sites More sharing options...
nysmenu Posted August 17, 2009 Author Share Posted August 17, 2009 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... Quote Link to comment Share on other sites More sharing options...
Lyleyboy Posted August 17, 2009 Share Posted August 17, 2009 Yep, definitely a server issue. Need to speak to your host as soon as. Quote Link to comment Share on other sites More sharing options...
AviNahum Posted August 17, 2009 Share Posted August 17, 2009 the problem is in your server, check the php.ini file... if you runing on wamp, open the php.ini file and search "mail_server = off" and change the off to on... Quote Link to comment Share on other sites More sharing options...
nysmenu Posted August 17, 2009 Author Share Posted August 17, 2009 I don't get it. Isn't WAMP a local server? This is happening on the remote server. do I still need to change in PHP_ini? Quote Link to comment Share on other sites More sharing options...
Lyleyboy Posted August 17, 2009 Share Posted August 17, 2009 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.