Results 1 to 10 of 10

Thread: send text to an email

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2003
    Posts
    108

    send text to an email

    on the click of a submit button, I'd like to send the text from a textbox to an email address.

    textbox: txtTest
    from : [email protected]
    to: [email protected]

    Please provide sample code,

    Thanks.

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: send text to an email

    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  3. #3
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: send text to an email

    you are going to need to send headers for the from part.
    My usual boring signature: Something

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jan 2003
    Posts
    108

    Re: send text to an email

    yes!

  5. #5
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: send text to an email

    did you get it to work?
    My usual boring signature: Something

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jan 2003
    Posts
    108

    Re: send text to an email

    no. it is not working.

    <?php

    $firstname=(string)$_POST["txtFirst"];
    $headers ='[email protected]'. phpversion();

    mail('[email protected]','Registration testing',$firstname,$headers);

    echo 'done';

    ?>

  7. #7
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: send text to an email

    try this...

    PHP Code:
    <?php

    error_reporting
    (E_ALL);

    $firstname=$_POST["txtFirst"];
    $headers ='[email protected]'phpversion();

    @
    mail('[email protected]','Registration testing',$firstname,$headers);

    echo 
    'done';

    ?>
    Last edited by dclamp; Apr 7th, 2008 at 08:14 PM.
    My usual boring signature: Something

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Jan 2003
    Posts
    108

    Re: send text to an email

    still not working. I wonder if it has anything to do with the HTML page.

    <form id="register" name="register" method="post" action="email.php">

    <table width="599" height="368" border="1">

    <tr>
    <td width="500"><table width="576" height="327">


    <tr>
    <td width="216"><div align="right" class="normal">First Name: </div></td>
    <td width="330"><input name="txtFirst" type="text" id="txtFirst" /></td>
    <td width="14">&nbsp;</td>
    </tr>
    <tr>
    <td><div align="right">
    <p class="normal">Last&nbsp;(Family) Name:</p>
    </div></td>
    <td><input name="txtLast" type="text" id="txtLast" /></td>
    <td>&nbsp;</td>
    </tr>


    <tr>
    <td><div align="right">
    <p class="normal">Address:</p>
    </div></td>
    <td><input name="txtAddr" type="text" id="txtAddr" /></td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td><div align="right">
    <p class="normal">Telephone Number:</p>
    </div></td>
    <td><input name="txtTel" type="text" id="txtTel" /></td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td><div align="right">
    <p class="normal">Cell Number:</p>
    </div></td>
    <td><input name="txtCell" type="text" id="txtCell" /></td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td><div align="right">
    <p class="normal">AA&amp;ITN:</p>
    </div></td>
    <td><input name="txtAA" type="text" id="txtAA" /></td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td><div align="right" class="normal">Trade: </div></td>
    <td><input name="txtTrade" type="text" id="txtTrade" /></td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td><div align="right" class="normal">Best time to contact you: </div></td>
    <td><input name="txtBest" type="text" id="txtBest" /></td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td><div align="right" class="normal">Other Notes: </div></td>
    <td><textarea name="textarea"></textarea></td>
    <td>&nbsp;</td>
    </tr>
    </table></td>
    </tr>

    </table>

    <p>
    <input name="btnSubmit" type="submit" id="btnSubmit" value="Submit" />
    </p>
    </form>

  9. #9
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: send text to an email

    can you please edit your post using [php][/php] tags or [html][/html] tags, thanks
    My usual boring signature: Something

  10. #10
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: send text to an email

    Quote Originally Posted by Academy
    no. it is not working.

    <?php

    $firstname=(string)$_POST["txtFirst"];
    $headers ='[email protected]'. phpversion();

    mail('[email protected]','Registration testing',$firstname,$headers);

    echo 'done';

    ?>
    Your headers are incorrectly formatted. They need to be in the format Name: value\r\n.

    E.g
    Code:
    $headers = 'From: [email protected]\r\n';
    $headers .= 'X-Client:' phpversion();
    Also you may want to set the sendmail_from directive n the php.ini to the from address too, to prevent an errornous reply_to header.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

Posting Permissions

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



Click Here to Expand Forum to Full Width