Closed Thread
Results 1 to 3 of 3
Like Tree3Likes
  • 1 Post By stevestephenemery74
  • 1 Post By essellar
  • 1 Post By stevestephenemery74

Thread: php form mail

  1. #1
    stevestephenemery74 is offline x10Hosting Member stevestephenemery74 is an unknown quantity at this point
    Join Date
    Nov 2011
    Posts
    2

    Unhappy php form mail

    Complete novice struggling to create site with form mail on it. I have followed all the advice I can find online but am getting nowhere and cannot get a php form to send an email. I have tried putting what is said to be a 'foolproof' mail checking code on the page scripted as follows:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    </head>

    <body>
    &lt;?php<br />
    mail('*****@gmail.com','Test mail','The mail function is working!');<br />
    echo 'Mail sent!';<br />
    ?&gt;
    </body>
    </html>

    When I load the page through my browser it reports:

    <?php
    mail('*****@gmail.com','Test mail','The mail function is working!');
    echo 'Mail sent!';
    ?>

    But I receive no mail. I have tried directing the mail to my x10 address, but this doesn't work either. I am sure I am missing something obvious (do I have to ativate php mail somewhere?), hoping somebody can help

    Many thanks

    Steve
    dinomirt96 likes this.

  2. #2
    essellar's Avatar
    essellar is offline Community Advocate essellar has a spectacular aura about
    Join Date
    Feb 2010
    Location
    Toronto, Ontario, CA
    Posts
    1,152

    Re: php form mail

    I hope you take this in the spirit intended, but "complete novice" is a bit of an understatement. Your page is doing exactly what you told it to do, which is to display the text you're seeing.

    The tags for PHP have to use real less-than and greater-than signs, not the &lt; and &gt; character entities if you want them to be interpreted by the server. So that part of your page should lokk like this:

    PHP Code:
    <?php
    mail
    ('*****@gmail.com','Test mail','The mail function is working!');
    echo 
    'Mail sent!';
    ?>
    The character combination <?php turns on the PHP interpreter; the ?> turns it off. The stuff between them is code that will be run by the server before the page is sent to the browser.

    By the way, this forum is for support issues -- things that are wrong with your hosting account, not with the code on your site. There is a separate form, Programming Help, for issues like this one. Most of the community doesn't have permission to respond in the support forum, but they can answer questions posted elsewhere, so you're more likely to get help (and sometimes hand-holding) if you post in the appropriate forum.
    karimirt47 likes this.
    “Beware of bugs in the above code; I have only proved it correct, not tried it.” --Donald Knuth
    "It was as if its architects were given a perfectly good hammer and gleefully replied, 'neat! With this hammer, we can build a tool that can pound in nails.'" -- Alex Papadimoulis (on TheDailyWTF.com)

  3. #3
    stevestephenemery74 is offline x10Hosting Member stevestephenemery74 is an unknown quantity at this point
    Join Date
    Nov 2011
    Posts
    2

    Re: php form mail

    Wrong forum, lesson learnt. Thanks for your guidance on the code - it now works!
    verlmirt17 likes this.

Closed Thread

Similar Threads

  1. form mail
    By sonyaseth90 in forum Free Hosting
    Replies: 0
    Last Post: 12-21-2010, 11:25 AM
  2. form to mail php
    By propctuner in forum Free Hosting
    Replies: 2
    Last Post: 11-13-2010, 10:34 PM
  3. Replies: 1
    Last Post: 10-04-2010, 02:46 PM
  4. form mail problem - sends but can't receive mail
    By scotlundy in forum Free Hosting
    Replies: 0
    Last Post: 02-11-2010, 10:04 AM
  5. mail form
    By jafbox in forum Scripts & 3rd Party Apps
    Replies: 5
    Last Post: 12-30-2008, 03:19 PM

Tags for this Thread

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