FlyingIsFun1217 Posted December 1, 2006 Share Posted December 1, 2006 Ok, for a software website I'm creating, I need to create a mail form. To do this, I just downloaded a simple mail example from this website and edited it a bit. Here's the form I created:[code="email.php"]<html><head><title>Comment...</title></head><body><form action="email-guts.php"><center><b>Nickname:</b></center><br/><center><input type="text" name="nickname" value="Your name/nickname"/></center><br/><br/><center><b>E-mail:</b></center><br /><center><input type="text" name="email" value="Your E-mail"/></center><br/><br/><center><b>Message:</b></center><br/><center><textarea name="message" rows="5" cols="50"></textarea></center><br /><center><input type="hidden" name="ip" value="<? echo $REMOTE_ADDR; ?>" /></center><center><input name="Submit" type="submit" value="Submit" /><input name="Submit" type="reset" value="Reset" /></center></form></body></html>[/code]...and connected it to email-guts.php:[code="email-guts.php"]<?$yourwebsite = "http://FIF1217.no-ip.org"; // Your website$recipientname = "FIF1217 Software Admin"; // Whats your name ?!$subject="FIF1217 Software Website"; // The subject of the mail thats being sended$recipient="FIF1217Software+form@gmail.com"; // the recipient$completetion_message="Thanks for sending us your comments!";/* The headers for the e-mail, no need to change it unless you know what you're doing*/$header = "From: $nickname <$email>\r\n";$header .= "MIME-Version: 1.0\r\n";$header .= "Content-Type: text/html; charset=iso-8859-1\r\n";$header .= "X-Priority: 3\r\n";$header .= "X-MSMail-Priority: Normal\r\n";$header .= "X-Mailer: PHP / ".phpversion()."\r\n";/* You can change the text below to whatever you wish to have for the way the mail is gonne be outputted, you can use HTML!*/$content= "Dear $recipientname, $nickname has sended you an e-mail from $yourwebsite.<br><br><b>Message:</b>$message<hr noshade=\"true\" size=\"1\" color=\"#000000\" />You can contact $nickname back at $email.";// Lets send the e-mail by using the mail() function, no need to change below...this can be edited above!mail($recipient, $content, $header);// Message the user will see if the e-mail is succesfully sended :)echo "Thanks for sending your message!";?>[/code]But every time that I try testing it out, it says that it submitted it (as I have taken out the original error code), but when I check my mail, it shows nothing!Is there something in php that should be changed to allow mail to be sent? Or something like that?Thanks,FlyingIsFun1217 Quote Link to comment https://forums.phpfreaks.com/topic/29166-help-with-mail/ Share on other sites More sharing options...
Philip Posted December 1, 2006 Share Posted December 1, 2006 Just a note - don't forget sending your subject line ;) Quote Link to comment https://forums.phpfreaks.com/topic/29166-help-with-mail/#findComment-133705 Share on other sites More sharing options...
FlyingIsFun1217 Posted December 1, 2006 Author Share Posted December 1, 2006 Alright, thanks... :)But my biggest issue at the current moment is that it does not send anything :(FlyingIsFun1217 Quote Link to comment https://forums.phpfreaks.com/topic/29166-help-with-mail/#findComment-133712 Share on other sites More sharing options...
kickassamd Posted December 1, 2006 Share Posted December 1, 2006 [code]<?$yourwebsite = "http://FIF1217.no-ip.org"; // Your website$recipientname = "FIF1217 Software Admin"; // Whats your name ?!$subject="FIF1217 Software Website"; // The subject of the mail thats being sended$recipient="FIF1217Software+form@gmail.com"; // the recipient$completetion_message="Thanks for sending us your comments!";$email = $_POST['email'];$nickname = $_POST['nickname'];/* The headers for the e-mail, no need to change it unless you know what you're doing*/$header = "From: $nickname <$email>\r\n";$header .= "MIME-Version: 1.0\r\n";$header .= "Content-Type: text/html; charset=iso-8859-1\r\n";$header .= "X-Priority: 3\r\n";$header .= "X-MSMail-Priority: Normal\r\n";$header .= "X-Mailer: PHP / ".phpversion()."\r\n";/* You can change the text below to whatever you wish to have for the way the mail is gonne be outputted, you can use HTML!*/$content= "Dear $recipientname, $nickname has sended you an e-mail from $yourwebsite.<br><br><b>Message:</b>$message<hr noshade=\"true\" size=\"1\" color=\"#000000\" />You can contact $nickname back at $email.";// Lets send the e-mail by using the mail() function, no need to change below...this can be edited above!//mail($recipient, $content, $header);if (mail($recipient, $subject, $content, $header)){// Message the user will see if the e-mail is succesfully sended :)echo "Thanks for sending your message!";}else{ echo "Failed Sending message";}?>[/code]Copy paste this over email-guts.php and try! Quote Link to comment https://forums.phpfreaks.com/topic/29166-help-with-mail/#findComment-133717 Share on other sites More sharing options...
FlyingIsFun1217 Posted December 1, 2006 Author Share Posted December 1, 2006 It just says: Failed Sending MessageWhich Is why I'm wondering if its something to do with php itself (like its not set up right...)FlyingIsFun1217 Quote Link to comment https://forums.phpfreaks.com/topic/29166-help-with-mail/#findComment-133722 Share on other sites More sharing options...
kickassamd Posted December 2, 2006 Share Posted December 2, 2006 Try one off of PHPs site[code]<?php// multiple recipients$to = 'aidan@example.com' . ', '; // note the comma$to .= 'wez@example.com';// subject$subject = 'Birthday Reminders for August';// message$message = '<html><head> <title>Birthday Reminders for August</title></head><body> <p>Here are the birthdays upcoming in August!</p> <table> <tr> <th>Person</th><th>Day</th><th>Month</th><th>Year</th> </tr> <tr> <td>Joe</td><td>3rd</td><td>August</td><td>1970</td> </tr> <tr> <td>Sally</td><td>17th</td><td>August</td><td>1973</td> </tr> </table></body></html>';// To send HTML mail, the Content-type header must be set$headers = 'MIME-Version: 1.0' . "\r\n";$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";// Additional headers$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";// Mail itmail($to, $subject, $message, $headers);?>[/code]Change the top two vars and test... if it fails then contact your host. Quote Link to comment https://forums.phpfreaks.com/topic/29166-help-with-mail/#findComment-133775 Share on other sites More sharing options...
FlyingIsFun1217 Posted December 2, 2006 Author Share Posted December 2, 2006 ;) My host is me, I'm using the abyss web server...Before I was using Apache, which wasn't very helpful, but now that I am using abyss, its gives me this for an error message:[quote]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 C:\Program Files\Abyss Web Server\htdocs\Current_Website\email-guts.php on line 34Failed Sending message[/quote]Thanks again!FlyingIsFun1217 Quote Link to comment https://forums.phpfreaks.com/topic/29166-help-with-mail/#findComment-133860 Share on other sites More sharing options...
FlyingIsFun1217 Posted December 2, 2006 Author Share Posted December 2, 2006 ...Anybody???FlyingIsFun1217 Quote Link to comment https://forums.phpfreaks.com/topic/29166-help-with-mail/#findComment-133889 Share on other sites More sharing options...
b00ty Posted December 4, 2006 Share Posted December 4, 2006 From what I can see it shows $recipient="FIF1217Software+form@gmail.com"; which is what the message is getting sent to. As far as I know the "+" symbol most the time takes the place of a space...which i know for sure that email addresses cant have any special characters of. make sure that it says your full email address and try again. Let me know if it works! Quote Link to comment https://forums.phpfreaks.com/topic/29166-help-with-mail/#findComment-134642 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.