Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-09-2003, 02:48 PM   PM User | #1
BerlinIT
New Coder

 
Join Date: Jun 2003
Location: Melbourne, Australia
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
BerlinIT is an unknown quantity at this point
mail() on Windows Hosted Server

I'm struggling to get a mail() function working on a windows server.. i have the exact same script working perfectly in a unix environment but it wont work on a windows server and its got me stumped. I've spoken to the host company who's said its a script problem, and that maybe i need to specify a server name or something (??).

Here's the script i'm using:

<?php
$Organisers_Name = $HTTP_POST_VARS["Organisers_Name"] ;
$Fundraiser_Organisation = $HTTP_POST_VARS["Fundraiser_Organisation"] ;
$Tel_Work = $HTTP_POST_VARS["Tel_Work"] ;
$Fax = $HTTP_POST_VARS["Fax"] ;
$Tel_Home = $HTTP_POST_VARS["Tel_Home"] ;
$Mobile = $HTTP_POST_VARS["Mobile"] ;
$Email = $HTTP_POST_VARS["Email"] ;
$Street_Address = $HTTP_POST_VARS["Street_Address"] ;
$Suburb = $HTTP_POST_VARS["Suburb"] ;
$State = $HTTP_POST_VARS["State"] ;
$Postcode = $HTTP_POST_VARS["Postcode"] ;
$Booking_Wine = $HTTP_POST_VARS["Booking_Wine"] ;
$Booking_Shopping = $HTTP_POST_VARS["Booking_Shopping"] ;
$Booking_Merch = $HTTP_POST_VARS["Booking_Merch"] ;
$Booking_WineryTours = $HTTP_POST_VARS["Booking_WineryTours"] ;
$Booking_Sporting = $HTTP_POST_VARS["Booking_Sporting"] ;
$Booking_Dinners = $HTTP_POST_VARS["Booking_Dinners"] ;
$Booking_DiscountBook = $HTTP_POST_VARS["Booking_DiscountBook"] ;
$Booking_WineryTours = $HTTP_POST_VARS["Booking_WineryTours"] ;
$Discount_Bar = $HTTP_POST_VARS["Discount_Bar"] ;
$Email_Updates = $HTTP_POST_VARS["Email_Updates"] ;
$Postcode = $HTTP_POST_VARS["Postcode"] ;


$Text= "Organiser Name: " .$Organisers_Name ."\n" .
"Fundraiser_Organisation: " .$Fundraiser_Organisation ."\n \n" .
"Ph (Work): " .$Tel_Work ."\n \n" .
"Fax: " .$Fax ;

$From= $Organisers_Name . "<" . $Email . ">";

mail("me@here.com", "Fun Raising Registration", $Text, "From:" .$From );
?>

Even if i just use this:

<?php mail("me@here.com", "My Subject", "Line 1\nLine 2\nLine 3");?>


it wont work. Anyone have any suggestions as to how on earth i can make this work (short of shifting the site to a unix server)???

Here's the php info file if anyone is interested in seeing that:
http://www.fundraisingmelbourne.com.au/test.php


Hoping somebody can shed some light here, cos the technical support are not helping much. They put a script in the directory and said its working, but all they put is the 2nd example above, and it DOES NOT work.

thanks in advance,
Greg
__________________
Berlin IT Services
- Website Design & Development
- Content Management Systems

Located: Melbourne, Australia
BerlinIT is offline   Reply With Quote
Old 10-09-2003, 06:23 PM   PM User | #2
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
Do you have an smtp server?
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 10-09-2003, 11:30 PM   PM User | #3
firepages
Super Moderator


 
Join Date: May 2002
Location: Perth Australia
Posts: 3,942
Thanks: 7
Thanked 82 Times in 81 Posts
firepages will become famous soon enough
Hi , if this is commercial hosting of any kind then its up to the host to have a mailserver up and running.

try the simplest script ...
<?php mail('you@yourdomain','test','test');?>

If it works then your host is right , check your script.

If that does not work then ask your host what mail server they have running
...If they say that they don't , well thats one way to help secure a win32 server , look for another host .
__________________
resistance is...

MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
firepages is offline   Reply With Quote
Old 10-10-2003, 12:07 AM   PM User | #4
BerlinIT
New Coder

 
Join Date: Jun 2003
Location: Melbourne, Australia
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
BerlinIT is an unknown quantity at this point
Quote:
Hi , if this is commercial hosting of any kind then its up to the host to have a mailserver up and running.

try the simplest script ...
<?php mail('you@yourdomain','test','test');?>
Yes it is a commercial host. One of the top hosting companies in australia apparently (their prices confirm this).

I tried this simple script:
<?php mail("me@here.com", "My Subject", "Line 1\nLine 2\nLine 3");?>

which is exactly what they said was working, and it doesnt work. Can anyone see anything wrong with the above script???

Quote:
If it works then your host is right , check your script.

If that does not work then ask your host what mail server they have running
...If they say that they don't , well thats one way to help secure a win32 server , look for another host .
yeah they seem to think its a scripting problem, and dont seem to be going out of their way to help me.. in fact they're going out of their way to get rid of me by putting the script above in the directory and saying "it works".

If i had the choice, i would move the site to a (different) unix host in a flash, but i'm subcontracting and cant make that choice.

If somebody can confirm that the above code is sound, then i'll get back to the host and (nicely) demand they make it work.

cheers,
Greg
__________________
Berlin IT Services
- Website Design & Development
- Content Management Systems

Located: Melbourne, Australia
BerlinIT is offline   Reply With Quote
Old 10-10-2003, 02:28 AM   PM User | #5
firepages
Super Moderator


 
Join Date: May 2002
Location: Perth Australia
Posts: 3,942
Thanks: 7
Thanked 82 Times in 81 Posts
firepages will become famous soon enough
OK , if you are using your own email address to test with , try someone elses or a hotmail/whatever account you have access to....

If that works but you can't send mail to yourself then thats an internal mailserver issue and not uncommon ... it would in probably mean that you could not send mail to any other domain hosted on the same server and that would be an issue for your host to chew on.

If that does not work and your entire test script looks like ...

<?php mail( 'mail@wherever.com' , 'test' , 'test' ) ;?>

... do you receive a PHP error message like 'Could not send ... blah' ? , if not then you need to shout at the host as that can't go wrong assuming the server is setup correctly.

1 thing to check is that PHP is actually enabled in the directory you are working from , eg add <?php phpinfo();?> to the above to see if you get any output.
__________________
resistance is...

MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
firepages is offline   Reply With Quote
Old 10-10-2003, 10:23 AM   PM User | #6
BerlinIT
New Coder

 
Join Date: Jun 2003
Location: Melbourne, Australia
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
BerlinIT is an unknown quantity at this point
thanks for the advice firepages...

i actually managed to get the script to work, by changing the email address to my work email address (i work for an isp, completely unrelated to the host that this site is on)... and it worked perfectly. then, all i changed was the emial address to my home email, and it didnt work!

php is enabled, the php info file is there already... http://www.fundraisingmelbourne.com.au/test.php


i really dont understand... why would it differentiate between email addresses... is it possible (and i know that this is a long shot) that it was using the mail server on my work computer or network to send the email??? cos when i hit 'send' on the form, the email appeared in my inbox almost immediately! no delay at all.. .could it be that the host has set the smtp server to 127.0.0.1 and that is causing the script to use the resident mail server on the pc accessign the site, instead of the host's mail server?? its a long shot but u never know really.

damn windows servers.
__________________
Berlin IT Services
- Website Design & Development
- Content Management Systems

Located: Melbourne, Australia
BerlinIT is offline   Reply With Quote
Old 10-10-2003, 11:36 AM   PM User | #7
firepages
Super Moderator


 
Join Date: May 2002
Location: Perth Australia
Posts: 3,942
Thanks: 7
Thanked 82 Times in 81 Posts
firepages will become famous soon enough
Quote:
Maximum execution time of 30 seconds exceeded in d:\webspace\..... blah
thats either a very slow or a very busy machine


err back to the issue , I know >.< about IIS and how its internal mailserver works so I can't advise , hopefully someone here can .

I can take a good guess though that its the mail server configuration OR the DNS MX records .... but seeing as you work at an ISP I guess you know how they work....

can you send email to blah @ fundraisingmelbourne . blah ? if not and if your DNS correctly points mail at your hosts nameserver then its almost certainly a configuration issue with your host , this is not uncommon on *NIX servers either with new domains and has happened to me more than once.

If that is the case I would send an email to your host noting that the same script works for 'such and such' a domain but not its own , that should wake them up a little ? (hopefully enough to buy apache/*NIX ) ... but check the DNS first so you don't end up looking like a dill (cos I been there many a time )
__________________
resistance is...

MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
firepages is offline   Reply With Quote
Old 10-10-2003, 02:08 PM   PM User | #8
BerlinIT
New Coder

 
Join Date: Jun 2003
Location: Melbourne, Australia
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
BerlinIT is an unknown quantity at this point
Well here's my solution... i found that their (the host's) test script worked when it was set to send an email to them directly, but when it was set to send an email to me (or any of my email addresses except my work address), it wouldn't work. So what i did was create an email @ fundraisingmelbourne.com.au and set the script to send email to there, and that worked fine. so my problem is solved.

the interesting thing is, why could the script only send emails to addresses with domains hosted on the same server, and my work email address which is definitely NOT on the same server, but no other email addresses. very odd indeed.

Quote:
Originally posted by firepages
I can take a good guess though that its the mail server configuration OR the DNS MX records .... but seeing as you work at an ISP I guess you know how they work....
no i dont. i work in an internet service provider (as in dial up and broadband), not a host, so this is all gobbledigook to me (well mostly anyway).

Quote:
can you send email to blah @ fundraisingmelbourne . blah ? if not and if your DNS correctly points mail at your hosts nameserver then its almost certainly a configuration issue with your host , this is not uncommon on *NIX servers either with new domains and has happened to me more than once.
i can. and they come through fine.

Quote:
If that is the case I would send an email to your host noting that the same script works for 'such and such' a domain but not its own , that should wake them up a little ? (hopefully enough to buy apache/*NIX ) ... but check the DNS first so you don't end up looking like a dill (cos I been there many a time ) [/B]
can you see any way that this could be anything but a configuration issue on the host's behalf?

either way, this host will never see any business from me, or anybody that asks me for their advice. they're a massively overpriced service, with only 8am-8pm technical support, and the guy who's there after 4pm is hopeless. not the sort of service you'd expect from a 'premium' priced service, that's for sure.

thanks for your help all... i'd be interested to know what went wrong, but since its working now it wouldnt bother me either way.. hopefully i dont have to ever have to deal with php on a windows server ever again!

cheers
Greg
__________________
Berlin IT Services
- Website Design & Development
- Content Management Systems

Located: Melbourne, Australia
BerlinIT is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:25 PM.


Advertisement
Log in to turn off these ads.