Results 1 to 6 of 6

Thread: PHP mail issue

  1. #1
    Join Date
    Mar 2009
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default PHP mail issue

    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

  2. #2
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    Have you got any code to show us of stuff you've tried so far?

    Mailing is normally pretty simple.

    PHP Code:
    $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.

  3. #3
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Quote Originally Posted by Rachele7 View Post
    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.)
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  4. #4
    Join Date
    Mar 2009
    Posts
    12
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by thetestingsite View Post
    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 Code:
    <?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.
    Last edited by Snookerman; 05-02-2009 at 10:51 AM. Reason: added [php] tags

  5. #5
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    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.

  6. #6
    Join Date
    May 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Try this:

    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:

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •