jorre13 Posted February 7, 2007 Share Posted February 7, 2007 I get following error in my contact.php: Warning: mail() [function.mail]: Failed to connect to mailserver at "194.78.239.173" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Site\Main\testphp\contact.php when i check the php.ini the smtp: 194.78.239.173 and the smtp_port: 25 <?php //phpinfo(); ini_set('display_errors',1); if (!isset($_POST['submit']) || $_SERVER['REQUEST_METHOD'] != "POST") { exit("<p>You did not press the submit button; this page should not be accessed directly.</p>"); } else { $exploits = "/(content-type|bcc:|cc:|document.cookie|onclick|onload|javascript|alert)/i"; $profanity = "/(beastial|bestial|blowjob|clit|cock|cum|cunilingus|cunillingus|cunnilingus|cunt|ejaculate|fag|felatio|fellatio|fuck|fuk|fuks|gangbang|gangbanged|gangbangs|hotsex|jism|jiz|kock|kondum|kum|kunilingus|orgasim|orgasims|orgasm|orgasms|phonesex|phuk|phuq|porn|pussies|pussy|spunk|xxx)/i"; $spamwords = "/(viagra|phentermine|tramadol|adipex|advai|alprazolam|ambien|ambian|amoxicillin|antivert|blackjack|backgammon|texas|holdem|poker|carisoprodol|ciara|ciprofloxacin|debt|dating|porn)/i"; $bots = "/(Indy|Blaiz|Java|libwww-perl|Python|OutfoxBot|User-Agent|PycURL|AlphaServer)/i"; if (preg_match($bots, $_SERVER['HTTP_USER_AGENT'])) { exit("<p>Known spam bots are not allowed.</p>"); } foreach ($_POST as $key => $value) { $value = trim($value); if (empty($value)) { exit("<p>Empty fields are not allowed. Please go back and fill in the form properly.</p>"); } elseif (preg_match($exploits, $value)) { exit("<p>Exploits/malicious scripting attributes aren't allowed.</p>"); } elseif (preg_match($profanity, $value) || preg_match($spamwords, $value)) { exit("<p>That kind of language is not allowed through our form.</p>"); } $_POST[$key] = stripslashes(strip_tags($value)); } if (!ereg("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,6})$",strtolower($_POST['email']))) { exit("<p>That e-mail address is not valid, please use another.</p>"); } $recipient ="[email protected]"; //"%73%61%6C%65%73%40%68%61%63%6F%2E%63%6F%6D";[email protected] $subject = "Haco site"; if(!empty($_POST['info_Sheet_Metal'])){ $subject .= " - {$_POST['info_Sheet_Metal']}"; } if(!empty($_POST['info_Chip_manufacturing'])){ $subject .= " - {$_POST['info_Chip_manufacturing']}"; } if(!empty($_POST['info_Woodworking'])){ $subject .= " - {$_POST['info_Woodworking']}"; } if(!empty($_POST['info_Surface_Treatment'])){ $subject .= " - {$_POST['info_Surface_Treatment']}"; } if(!empty($_POST['info_Presses'])){ $subject .= " - {$_POST['info_Presses']}"; } if(!empty($_POST['info_Foundry'])){ $subject .= " - {$_POST['info_Foundry']}"; } $message = "You've received an e-mail through your website mail form: \n <br>"; $message .= "Company: {$_POST['company']} \n <br>"; $message .= "Name: {$_POST['name']} \n <br>"; $message .= "FirstName: {$_POST['firstname']} \n\n <br> <br>"; $message .= "Street: {$_POST['street']} \n <br>"; $message .= "Nr: {$_POST['NR']} \n <br>"; $message .= "Place: {$_POST['place']} \n <br>"; $message .= "Postcode: {$_POST['postcode']} \n <br>"; $message .= "Country: {$_POST['country']} \n\n <br> <br>"; $message .= "E-mail: {$_POST['email']} \n <br>"; $message .= "Phone: {$_POST['phone']} \n <br>"; $message .= "Mobile: {$_POST['mobile']} \n\n <br> <br>"; $message .= "Info: {$_POST['additionalinfo']} \n <br>"; $headers = "From: Haco site $recipient \n <br>"; $headers .= "Reply-To: {$_POST['email']}"; if (mail($recipient,$subject,$message,$headers)) { echo "<p>Thank you! Your mail was successfully sent to the webmaster. Thank you for your time.</p>"; } else { echo "<br><p>Sorry, there was an error and your mail was not sent. Please find an alternative method of contacting the webmaster.</p>"; } } ?> could anyone please help me Link to comment https://forums.phpfreaks.com/topic/37441-mail-problem/ Share on other sites More sharing options...
JasonLewis Posted February 7, 2007 Share Posted February 7, 2007 if your running this off your own computer then you need a mail server. well, thats what i got. i am using ArGoMailServer, search google for something like that. Link to comment https://forums.phpfreaks.com/topic/37441-mail-problem/#findComment-179009 Share on other sites More sharing options...
jorre13 Posted February 7, 2007 Author Share Posted February 7, 2007 I run the script online http://www.haco.com/main/testphp/contact.htm 194.78.239.173 is my mailserver Why do i need another mailserver like ArgoMailServer?? Link to comment https://forums.phpfreaks.com/topic/37441-mail-problem/#findComment-179021 Share on other sites More sharing options...
jorre13 Posted February 7, 2007 Author Share Posted February 7, 2007 Could anyone help me?? Link to comment https://forums.phpfreaks.com/topic/37441-mail-problem/#findComment-179169 Share on other sites More sharing options...
Balmung-San Posted February 7, 2007 Share Posted February 7, 2007 Does the mail server actually run SMTP through port 25? Link to comment https://forums.phpfreaks.com/topic/37441-mail-problem/#findComment-179174 Share on other sites More sharing options...
jorre13 Posted February 7, 2007 Author Share Posted February 7, 2007 yes it runs smtp on port 25, normally every mailserver does that. When i us telnet to test, it is possible for me to send a email with the ip of the mailserver(194.78.239.173) and the port 25 Link to comment https://forums.phpfreaks.com/topic/37441-mail-problem/#findComment-179179 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.