Log in

View Full Version : PHP mail issue



Rachele7
05-01-2009, 05:10 PM
Hi all,

not sure if this is the right area for this but here goes.

I'm trying to setup php on a server so the website's contact form can be used by web visitors. I have tried a whole bunch of stuff on the web all to no avail.

Thanks.

R

Schmoopy
05-01-2009, 06:20 PM
Have you got any code to show us of stuff you've tried so far?

Mailing is normally pretty simple.



$to = 'randomuser@hotmail.com';
$subject = 'News';
$message = 'Here\'s some mail';
$headers = 'From: myname@mysite.com';

mail($to, $subject, $message, $headers);


Just put that on a test page somewhere and upload it to your site, change the $to variable to your email address and see if you receive an email. If you do then reply to this and tell us what more you need.

thetestingsite
05-02-2009, 03:59 AM
I'm trying to setup php on a server so the website's contact form can be used by web visitors.

Are you trying to set up php on the server itself or are you looking for a code snippet that will send email using php that is already installed on a server. If the latter, see the post above; however, if you are trying to install php, please post what OS you are using as well as the current setup (web server, database, etc.)

Rachele7
05-02-2009, 10:48 AM
Are you trying to set up php on the server itself or are you looking for a code snippet that will send email using php that is already installed on a server. If the latter, see the post above; however, if you are trying to install php, please post what OS you are using as well as the current setup (web server, database, etc.)


Well php has been installed on the server but basically we are not able to receive any mail. I have uploaded php codes like the one posted by Schmoopy (thanks Schmoopy) but we did not receive any mail. I am assuming that there is something not quite working properly on the server.

We've tried the following test script


<?php
if(mail('info@website.com','test subject','test message')){
echo('ok');
}
else{
echo('not ok');
}
?>

http://www.surfcelive.com/try.php

It comes up with not ok.


Its a windows 2003 server, with MySQL, php, perl installed on it.

Thanks.

Schmoopy
05-02-2009, 03:03 PM
Maybe try contacting your host to see what they have to say, there's no code I can give you to fix the problem and the people who will know your server best will be the people who own it.

chulagrl24
05-07-2009, 05:49 PM
http://www.000webhost.com/forum/7306-post51.html

I am used to being able to use the contact php in a webhost - but right now I am using this free hosting acct and it does not give you an option to enable email php - so I had to do php script. This was a post I found and it works great. However, you may edit it to your needs. Hope this is what you were looking for: