Closed Thread
Results 1 to 9 of 9

Thread: PHP Mail not working

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

    PHP Mail not working

    Hi, I tested to see if php mail is working for when I upload my site and after sending a text message I am still waiting to receive it is there a problem with the mail server or does it just not work full stop?

    Thanks

  2. #2
    stpvoice's Avatar
    stpvoice is offline Community Support Rep stpvoice has a brilliant futurestpvoice has a brilliant futurestpvoice has a brilliant future
    Join Date
    Dec 2008
    Location
    United Kingdom
    Posts
    5,939

    Re: PHP Mail not working

    Hello,

    To what email address did you send it? E.g. was it to a Gmail, live etc?

    Thanks.


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

    Re: PHP Mail not working

    Hi, it was to both gmail and live... sample script is

    PHP Code:
    <?php
    // multiple recipients
    $to  'james@******.co.uk' ', '// note the comma
    $to .= '******@hotmail.co.uk';

    // subject
    $subject 'Birthday Reminders for August';

    // message
    $message '
    <html>
    <head>
      <title>Birthday Reminders for August</title>
    </head>
    <body>
      <p>Here are the birthdays upcoming in August!</p>
      <table>
        <tr>
          <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
        </tr>
        <tr>
          <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
        </tr>
        <tr>
          <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
        </tr>
      </table>
    </body>
    </html>
    '
    ;

    // To send HTML mail, the Content-type header must be set
    $headers  'MIME-Version: 1.0' "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' "\r\n";

    // Additional headers
    $headers .= 'To: James ***** <james@******.co.uk>' "\r\n";
    $headers .= 'From: JPO Legal Team <info@******.co.uk>' "\r\n";

    // Mail it
    mail($to$subject$message$headers);
    ?>
    thank

  4. #4
    Anna's Avatar
    Anna is offline I am just me Anna is a name known to allAnna is a name known to all
    Join Date
    Aug 2007
    Location
    Sweden
    Posts
    6,569

    Re: PHP Mail not working

    You'll need to have text/plain as content-type for it to work, mail server silently eats the mail otherwise.
    Do you have trouble reaching your site?
    Check here first: News and Announcements


    Don't forget that x10hosting has an irc server as well. Come and join the fun
    server: irc.x10hosting.com, main channel: #x10hosting
    There's a lot helpful users there if need help building your site

  5. #5
    stpvoice's Avatar
    stpvoice is offline Community Support Rep stpvoice has a brilliant futurestpvoice has a brilliant futurestpvoice has a brilliant future
    Join Date
    Dec 2008
    Location
    United Kingdom
    Posts
    5,939

    Re: PHP Mail not working

    Hello,

    I've spoken to one of our admins. Apparently, php mail only works if the type is set to text/plain. Also, there are known issues with sending to both gmail and windows live, as the free servers are often blacklisted due to past abuse. I know for a fact that in some cases, windows live won't even display a message sent from free. It doesn't even go into spam.


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

    Re: PHP Mail not working

    Ok I have changed the content type as advised, still getting problems though, included a little error catch in the code to see if it is actually working before being sent out...

    PHP Code:
    <?php
    // multiple recipients
    $to  'james@********' ', '// note the comma
    $to .= '********@hotmail.co.uk';

    // subject
    $subject 'Testing Email for site';

    // message
    $message '
    Test Email Message
    '
    ;

    // To send HTML mail, the Content-type header must be set
    $headers  'MIME-Version: 1.0' "\r\n";
    $headers .= 'Content-type: text/plain; charset=iso-8859-1' "\r\n";

    // Additional headers
    $headers .= 'To: James *********l <james@********.co.uk>' "\r\n";
    $headers .= 'From: JPO Legal Team <info@********t.co.uk>' "\r\n";

    // Mail it
    if (mail($to,$subject,$message,$headers) ) {
           echo 
    "email sent";
        } else {
           echo 
    "email couldn't be sent";
    };
    ?>
    Is there something wrong in this code or am I doing things correctly?

    Thanks

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

    Re: PHP Mail not working

    Anyone???

  8. #8
    Anna's Avatar
    Anna is offline I am just me Anna is a name known to allAnna is a name known to all
    Join Date
    Aug 2007
    Location
    Sweden
    Posts
    6,569

    Re: PHP Mail not working

    The code works fine, I just copied it onto my test acct on the same server as you're on, and it sent nicely to gmail and my personal domain.

    Most likely the emails would come to either spam bin, or in worst case silently be dropped by the recipients mail provider due to our servers being marked as sending spam (past abuse does cause a problem with some providers), if they aren't located in the inbox.
    Do you have trouble reaching your site?
    Check here first: News and Announcements


    Don't forget that x10hosting has an irc server as well. Come and join the fun
    server: irc.x10hosting.com, main channel: #x10hosting
    There's a lot helpful users there if need help building your site

  9. #9
    taha116's Avatar
    taha116 is offline x10 Lieutenant taha116 is an unknown quantity at this point
    Join Date
    Nov 2007
    Posts
    497

    Re: PHP Mail not working

    I have a similar problem, but the thing is I dont know much about php myself. Im using opencart and I cant seem to have any activation emails mailed out automatically. anything you guys can think of thatll help?


    Need help with starting up your website? No problemo PM if you need help, if you want help with scripts like WordPress, SMF and so on dont be afraid to PM for that too.


Closed Thread

Similar Threads

  1. PHP Mail function not working.Please check the mail log
    By vv.bbcc19 in forum Free Hosting
    Replies: 0
    Last Post: 01-15-2011, 12:08 AM
  2. Replies: 4
    Last Post: 10-16-2010, 02:01 AM
  3. E-mail may not be working
    By thecold0ne in forum Free Hosting
    Replies: 1
    Last Post: 03-21-2010, 11:22 PM
  4. Mail not working?
    By Tideas in forum Free Hosting
    Replies: 2
    Last Post: 11-05-2007, 06:49 PM
  5. PHP mail() not working
    By nolan in forum Free Hosting
    Replies: 10
    Last Post: 07-11-2007, 02:15 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