Jump to content

[SOLVED] Mail issue /w code


zushiba

Recommended Posts

Okay here's the problem, I work at a school and while they use MS for everything including running ASP on their main sites I managed to convince them to set up a box running Apache & PHP, I didn't want to push my luck so it's running in windows with mssql.

 

For a project we're working on I need to set up a forum for the various instructors to be a kind of virtual meeting ground so we don't have to meet in real life.

 

Here's the problem, somehow the mail settings are incorrect, while not having access to php.ini I need to figure out whats wrong and how to fix it.

 

To do this I've set up a very basic form to send some test data to a given email address, the form itself works wonderfully so I won't bother pasting that here.

 

Here's the code

<?php
include("global.inc.php");
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
pt_register('POST','email_addy');
pt_register('POST','name');
pt_register('POST','pass');
pt_register('POST','testbox');
//echo $email_addy;
if($errors==1) echo $error;
else{
$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
$message="name: ".$name."
pass: ".$pass."
testbox: ".$testbox."
";
$message = stripslashes($message);
mail($email_addy,"Form Submitted at your website",$message,"From: The Mail Test");
?>

<h2>Thank you!</h2>

<table width=50%>
<tr><td>name: </td><td> <?php echo $name; ?> </td></tr>
<tr><td>pass: </td><td> <?php echo $pass; ?> </td></tr>
<tr><td>testbox: </td><td> <?php echo $testbox; ?> </td></tr>
</table>

 

 

Now here's the deal, I have this exact script set up and working absolutely perfectly on my own server, so the code cannot be the problem. On my box it sends mail perfectly however on the windows box at work I get the following

Warning: mail() [function.mail]: SMTP server response: 501 5.5.4 Invalid Address in D:\web sites\IR Website\mailTest\process.php on line 18

and no mail is sent.

 

Link to comment
Share on other sites

It wasn't (and still probably isn't) I had to send the admin. The original error we got was

Warning: mail() [[ http://**********.edu/mailTest/function.mail ]function.mail]: Failed to connect to mailserver at "128.128.127.31" port 25, verify your "SMTP" and "smtp_port" setting in php.ini

 

He did something and now we are getting the new error, I don't believe he has much knowledge on the subject of php or it's configuration so it's entirely possible he misconfigured it in some manner but i don't have access to it so I've no clue what the problem is or even if it's a problem with php.ini or with the servers mail setting itself.

Link to comment
Share on other sites

A lot of public servers close port 25 nowadays, so that might be an issue. Might just get away with supplying the right port if so... as for the rest of it, we can only start guessing...

 

There is no security issue with viewing the php.ini, so if your admin will kindly provide you with it (it's just a plain text file), you can post the SMTP section here and we can give you suggestions. Can't imagine they won't accomodate you if they've gone through this much trouble to get you setup with the server... on the other hand, they may not want mail going out through PHP, and that's their call...

 

PhREEEk

Link to comment
Share on other sites

I was able to obtain a copy of the php.ini, I simply don't like to bother the guys in IT much they are having an especially hard time trying to implement a brand new network while trying to keep the old one running when a good half of the people that ran it have left :P

 

[mail function]

; For Win32 only.

SMTP = 192.168.254.206 ; for Win32 only

smtp_port = 25

sendmail_from= "mail operator" ; for Win32 only

 

; For Win32 only.

;sendmail_from = me@example.com

 

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").

;sendmail_path =

 

; Force the addition of the specified parameters to be passed as extra parameters

; to the sendmail binary. These parameters will always replace the value of

; the 5th parameter to mail(), even in safe mode.

;mail.force_extra_parameters =

Link to comment
Share on other sites

Ok, well I'm more of a Linux setup person, so I'll step away and avoid throwing guesses at you, which will probably waste your IT people's time...

 

I would suggest you re-post/restate the problem, along with this snippet of the php.ini, to the PHP Setup Forum here at Freaks. Use a nice descriptive post title too...

 

I have seen some SMTP workarounds posted, that prove one way or another where a problem may lie. You might ask the experts on setup if they can suggest something for you to try before you go botherin' those hard workin' underpaid, under appreciated IT folk! hehehe

 

Best of luck man!

 

PhREEEk

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.