+ Reply to Thread
Results 1 to 4 of 4
Like Tree2Likes
  • 1 Post By anders0nge018
  • 1 Post By lemon-tree

Thread: What do i need to install to get php mail() to work?

  1. #1
    anders0nge018 is offline x10Hosting Member anders0nge018 is an unknown quantity at this point
    Join Date
    Apr 2011
    Posts
    5

    What do i need to install to get php mail() to work?

    sorry but i'm new to php scripting, but i can't seem to get mail() to work. Here's my index.php... replace TO EMAIL and FROM EMAIL with any valid email (i use my x10 acct for "from" and gmail acct for "to" but i also tried sending just to my x10 acct)... anyway thanks in advance.

    Code:
    <html>
    <body>
    
    <?php
    
    // mail example (doesn't work - no mail server???)
    
    $to = "TO EMAIL";
    $subject = "Test Mail";
    $message = "Hello! This is a simple test email!";
    $from = "FROM EMAIL";
    $headers = "From: " . $from;
    if(!mail($to, $subject, $message, $headers))
    	echo "mail error<br/>";
    else
    	echo "mail sent<br/>";
    
    ?>
    </body>
    </html>
    dinomirt96 likes this.

  2. #2
    anders0nge018 is offline x10Hosting Member anders0nge018 is an unknown quantity at this point
    Join Date
    Apr 2011
    Posts
    5

    Re: What do i need to install to get php mail() to work?

    any suggestions???
    i also noticed there are no php.ini files (or i can't find them)? perhaps i have the wrong type of account???

    thanks in advance

  3. #3
    lemon-tree's Avatar
    lemon-tree is offline x10 Minion lemon-tree has a spectacular aura about
    Join Date
    Nov 2007
    Posts
    1,420

    Re: What do i need to install to get php mail() to work?

    On free hosting, (or any shared host for that matter) the php.ini file is not available for editing by individual users, as that would alter the settings for every other user on the system.

    The mail function should be working. Does that code return "mail sent" or "mail error" when you try to run it and if it is appearing to be sent have you checked your spam inbox in Gmail?
    karimirt47 likes this.

  4. #4
    anders0nge018 is offline x10Hosting Member anders0nge018 is an unknown quantity at this point
    Join Date
    Apr 2011
    Posts
    5

    Re: What do i need to install to get php mail() to work?

    Quote Originally Posted by lemon-tree View Post
    On free hosting, (or any shared host for that matter) the php.ini file is not available for editing by individual users, as that would alter the settings for every other user on the system.

    The mail function should be working. Does that code return "mail sent" or "mail error" when you try to run it and if it is appearing to be sent have you checked your spam inbox in Gmail?
    yeah i figured that out about php.ini, sorry a bit of noob to this whole scripting thing... anyway i just got it to work, i had skipped past the "getting started" wizard so i never set up a mail account through it, i did do it manually but obviously i missed something... running through the wizard solved the issue... but thanks for your reply!

+ Reply to Thread

Similar Threads

  1. how to install cgi form mail
    By sonyaseth90 in forum Free Hosting
    Replies: 2
    Last Post: 12-22-2010, 07:42 AM
  2. Replies: 0
    Last Post: 05-13-2010, 08:54 PM
  3. Replies: 1
    Last Post: 04-15-2010, 04:14 PM
  4. mail() doesn't work !
    By unknownstorm in forum Free Hosting
    Replies: 9
    Last Post: 09-02-2008, 10:24 PM
  5. phpBB2 fantisco and hand install do not work
    By pthalmann in forum Free Hosting
    Replies: 4
    Last Post: 10-06-2007, 12:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers