+ Reply to Thread
Results 1 to 5 of 5

Thread: Sending email issue

  1. #1
    kim_foxx is offline x10Hosting Member kim_foxx is an unknown quantity at this point
    Join Date
    Apr 2010
    Posts
    31

    Sending email issue

    I cant seem to get the users email to be sent to me... Whenever a user fill in the box i get their name and their message but not the email that they supplied... Can anyone see anything wrong with the code?

    Thanks in advanced.


    HTML:


    <p align="left">Email:<br >
    <input name="email" id="email" size="40" >


    ------------


    <?php

    function is_valid_email($from_email)
    {
    return preg_match('#^[a-z0-9.!\#$%&\'*+-/=?^_`{|}~]+@([0-9.]+|([^\s\'"<>]+\.+[a-z]{2,6}))$#si', $from_email);
    }

    $to_email = "XXXX@hotmail.com";
    $subject = "secret";
    $name.=$_POST['name']."\n" ;
    $from_email.=$_POST['email']."\n" ;
    $msg.=$_POST['message']."\n" ;

    $message = "
    Name:
    $name
    Email:
    $email
    Message:
    $msg

    ";

  2. #2
    AngusThermopyle is offline x10Hosting Member AngusThermopyle is an unknown quantity at this point
    Join Date
    Nov 2009
    Posts
    84

    Re: Sending email issue

    Quote Originally Posted by kim_foxx View Post

    <?php

    function is_valid_email($from_email)
    {
    return preg_match('#^[a-z0-9.!\#$%&\'*+-/=?^_`{|}~]+@([0-9.]+|([^\s\'"<>]+\.+[a-z]{2,6}))$#si', $from_email);
    }

    $to_email = "XXXX@hotmail.com";
    $subject = "secret";
    $name.=$_POST['name']."\n" ;
    $from_email.=$_POST['email']."\n" ;
    $msg.=$_POST['message']."\n" ;

    $message = "
    Name:
    $name
    Email:
    $email
    Message:
    $msg

    ";
    .

  3. #3
    kim_foxx is offline x10Hosting Member kim_foxx is an unknown quantity at this point
    Join Date
    Apr 2010
    Posts
    31

    Re: Sending email issue

    Do i need to change the $from_email from the below code as well?
    To be honest i dont even know what the below code does. I read on the forums awhile ago it is for protection...

    function is_valid_email($from_email)
    {
    return preg_match('#^[a-z0-9.!\#$%&\'*+-/=?^_`{|}~]+@([0-9.]+|([^\s\'"<>]+\.+[a-z]{2,6}))$#si', $from_email);

  4. #4
    as4s1n's Avatar
    as4s1n is offline x10 Sophmore as4s1n is an unknown quantity at this point
    Join Date
    Apr 2009
    Location
    Washington State
    Posts
    174

    Re: Sending email issue

    The preg_replace checks the input for a specific pattern of numbers/letters/characters. (I.E. yourEmail@email.com). That protects to make sure it is a valid email and to prevent any unwanted code (SQL injection).

    To make it easier just change the $email to $from_email. You defined $from_email but called an undefined variable $email.
    Last edited by as4s1n; 05-13-2010 at 11:40 AM.
    There is no such thing as a "stupid question," there are only "stupid people" who don't ask them.

  5. #5
    AngusThermopyle is offline x10Hosting Member AngusThermopyle is an unknown quantity at this point
    Join Date
    Nov 2009
    Posts
    84

    Re: Sending email issue

    Just change the $email to $from_email .

+ Reply to Thread

Similar Threads

  1. Sending Email ASP.NET/SMTP - Firewall issue?
    By audichya in forum Free Hosting
    Replies: 1
    Last Post: 01-21-2010, 02:36 PM
  2. Email not sending
    By newscape in forum Free Hosting
    Replies: 6
    Last Post: 11-08-2009, 02:13 PM
  3. Sending email with ASP.NET in C#
    By wraithlunati in forum Free Hosting
    Replies: 0
    Last Post: 07-24-2009, 02:00 PM
  4. Help me in sending Email
    By Nahid_hossain in forum Programming Help
    Replies: 1
    Last Post: 10-22-2008, 11:40 PM
  5. Sending Email
    By persiantnt in forum Free Hosting
    Replies: 0
    Last Post: 06-10-2008, 09:33 AM

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