craigeves Posted November 27, 2008 Share Posted November 27, 2008 I am designing a site for a friend... but keep getting the following error when i submit the form. warning: mail(): Failed to connect to a mail server at "mxhost-1.vi.net" port 25, verify your "SMTP" and "smtp_port" in php.ini or use ini_set() in D:\webhost\sendresults.php on line 39 This works fine on my website - can anyone tell me why it's not working properly now and how do i fix it? Here's my code... <?php //--------------------------Set these paramaters-------------------------- // Subject of email sent to you. $subject = 'Sample Request'; // Your email address. This is where the form information will be sent. $emailadd = 'myemail@googlemail.com'; // Where to redirect after form is processed. $url = 'thanks.html'; // Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty. $req = '0'; // --------------------------Do not edit below this line-------------------------- $text = "Sample Request:\n\n"; $space = ' '; $line = ' '; foreach ($_POST as $key => $value) { if ($req == '1') { if ($value == '') {echo "$key is empty";die;} } $j = strlen($key); if ($j >= 20) {echo "Name of form element $key cannot be longer than 20 characters";die;} $j = 20 - $j; for ($i = 1; $i <= $j; $i++) {$space .= ' ';} $value = str_replace('\n', "$line", $value); $conc = "{$key}:$space{$value}$line"; $text .= $conc; $space = ' '; } mail($emailadd, $subject, $text, 'From: '.$emailadd.''); echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">'; ?> Many thanks Quote Link to comment https://forums.phpfreaks.com/topic/134440-php-form-not-submitting/ Share on other sites More sharing options...
Maq Posted November 27, 2008 Share Posted November 27, 2008 Is your friend's site being hosted on a different server? I think you have to configure mail. Quote Link to comment https://forums.phpfreaks.com/topic/134440-php-form-not-submitting/#findComment-699902 Share on other sites More sharing options...
DeanWhitehouse Posted November 27, 2008 Share Posted November 27, 2008 Look at http://djw-webdesign.awardspace.com/code.php?snippet=10 and http://djw-webdesign.awardspace.com/code.php?snippet=3 That may enlighten you, on my host i was only allowed to use a email that was registered on a site and i had to pay before the mail function could be used. Quote Link to comment https://forums.phpfreaks.com/topic/134440-php-form-not-submitting/#findComment-699905 Share on other sites More sharing options...
craigeves Posted November 27, 2008 Author Share Posted November 27, 2008 Is your friend's site being hosted on a different server? I think you have to configure mail. Yes he is on a different server. Different hosting company altogether. But they still run PHP. Does that make a difference then? Sorry - quite new to PHP. I try to pick bits up as I go. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/134440-php-form-not-submitting/#findComment-699907 Share on other sites More sharing options...
DeanWhitehouse Posted November 27, 2008 Share Posted November 27, 2008 on my host i was only allowed to use a email that was registered on a site and i had to pay before the mail function could be used. Quote Link to comment https://forums.phpfreaks.com/topic/134440-php-form-not-submitting/#findComment-699909 Share on other sites More sharing options...
craigeves Posted November 27, 2008 Author Share Posted November 27, 2008 on my host i was only allowed to use a email that was registered on a site and i had to pay before the mail function could be used. He already has a mail function in operation on the site, but its ASP - I am now switching over to PHP for the new site. Do you think this would make a difference them not allowing the mail function to be used? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/134440-php-form-not-submitting/#findComment-699912 Share on other sites More sharing options...
DeanWhitehouse Posted November 27, 2008 Share Posted November 27, 2008 Have you contacted them asking? Also they may (again) only allow emails registered on the site to be used in the function. You will need to contact them about there settings. Quote Link to comment https://forums.phpfreaks.com/topic/134440-php-form-not-submitting/#findComment-699915 Share on other sites More sharing options...
craigeves Posted November 27, 2008 Author Share Posted November 27, 2008 Have you contacted them asking? Also they may (again) only allow emails registered on the site to be used in the function. You will need to contact them about there settings. I have just emailed my friend to get him to get in contact with them. I have tried the an email address at that domain but still no luck. As soon as I get an answer i'll post a reply here to keep everyone updated in case it helps anyone else. Thanks! C Quote Link to comment https://forums.phpfreaks.com/topic/134440-php-form-not-submitting/#findComment-699920 Share on other sites More sharing options...
DeanWhitehouse Posted November 27, 2008 Share Posted November 27, 2008 ok good, contacting the host can sometimes be the best way to root out problems Quote Link to comment https://forums.phpfreaks.com/topic/134440-php-form-not-submitting/#findComment-699921 Share on other sites More sharing options...
craigeves Posted December 4, 2008 Author Share Posted December 4, 2008 I contacted the host and they told me.... If you are trying to send out emails from our server please use our relay service (sharedrelay.acitve24.com). thank you. Ps. This is a relay server on port 25, it does not require authentication from our network but your traffic will monitored. Does anyone know how I would add the ini_set() code to my script to change the server? Many thanks Craig Quote Link to comment https://forums.phpfreaks.com/topic/134440-php-form-not-submitting/#findComment-705835 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.