SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Thread: sendmail.php

  1. #1
    SitePoint Member
    Join Date
    Aug 2006
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    sendmail.php

    I am wondering about a form reply address. i am tryin to get the sendmail fuction to get a reply email address form the person sending it. instead i get the website its comming from but no reply email the reply email is my website. how can i spoof it so its the persons email??

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    16,449
    Mentioned
    160 Post(s)
    Tagged
    1 Thread(s)

    email reply

    Hi repozone, welcome to the forums,
    I'm not clear as to what you're asking. You have a form on your site that allows users to send email from your site, and you want the "reply" header to be the users email? Have you tried setting the header to their entered email address?

  3. #3
    Fully Sweet Car noddy's Avatar
    Join Date
    Aug 2002
    Location
    Perth, Western Australia
    Posts
    759
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In the headers add

    PHP Code:
    $header .= '"Reply-to: $from_email\r\n"; 
    That should work fine.

  4. #4
    SitePoint Member
    Join Date
    Aug 2006
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    here the code i have its pretty much an appication but like i said the email address is the website email address, so where do i put the code in i keep getting an error

    PHP Code:
    <?php
      $fullname 
    $_REQUEST['fullname'] ;
      
    $phone $_REQUEST['phone'] ;
      
    $email $_REQUEST['email'] ;
      
    $street $_REQUEST['street'] ;
      
    $city $_REQUEST['city'] ;
      
    $state $_REQUEST['state'] ;
      
    $postal $_REQUEST['postal'] ;
      
    $job $_REQUEST['job'] ;
      
    $company_1 $_REQUEST['company_1'] ;
      
    $position_1 $_REQUEST['position_1'] ;
      
    $date_began_1 $_REQUEST['date_began_1'] ;
      
    $date_end_1 $_REQUEST['date_end_1'] ;
      
    $duties_1 $_REQUEST['duties_1'] ;
      
    $company_2 $_REQUEST['company_2'] ;
      
    $position_2 $_REQUEST['position_2'] ;
      
    $date_began_2 $_REQUEST['date_began_2'] ;
      
    $date_end_2 $_REQUEST['date_end_2'] ;
      
    $duties_2 $_REQUEST['duties_2'] ;
      
    $salary_required $_REQUEST['salary_required'] ;
      
    $availability $_REQUEST['availability'] ;
      
    $transportation $_REQUEST['transportation'] ;
      
    $certificates $_REQUEST['certificates'] ;
      
    $message "";
      
    mail"apply@capital-staffing.com""application",
        
    "$message\n CONTACT INFO:\n Here is my info:\nfull name:$fullname\n contact me at:$phone\n Email:$email\n My Address Is: $street\n $city\n $state\n $postal\nI am interested in $job as my preference to type of work\n\nEmployment History:(employer 1)\n Company: $company_1   Position: $position_1\nDate(start/end): $date_began_1 to $date_end_1\nDuties include: $duties_1\n\nEmployment History:(employer 2)\nCompany: $company_2   Position: $position_2\nDate(start/end): $date_began_2 to $date_end_2\nDuties include: $duties_2\nI am available: $availability\n \n\nMy certificates include: $certificates\nTransportation: $transportation\n\n                Thank you for your time  $fullname""From: $email);
     
    header("Location: http://www.mypage.html");
    ?>

  5. #5
    Fully Sweet Car noddy's Avatar
    Join Date
    Aug 2002
    Location
    Perth, Western Australia
    Posts
    759
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by repozone
    here the code i have its pretty much an appication but like i said the email address is the website email address, so where do i put the code in i keep getting an error

    PHP Code:
       <?php
         $fullname 
    $_REQUEST['fullname'] ;
         
    $phone $_REQUEST['phone'] ;
         
    $email $_REQUEST['email'] ;
         
    $street $_REQUEST['street'] ;
         
    $city $_REQUEST['city'] ;
         
    $state $_REQUEST['state'] ;
         
    $postal $_REQUEST['postal'] ;
         
    $job $_REQUEST['job'] ;
         
    $company_1 $_REQUEST['company_1'] ;
         
    $position_1 $_REQUEST['position_1'] ;
         
    $date_began_1 $_REQUEST['date_began_1'] ;
         
    $date_end_1 $_REQUEST['date_end_1'] ;
         
    $duties_1 $_REQUEST['duties_1'] ;
         
    $company_2 $_REQUEST['company_2'] ;
         
    $position_2 $_REQUEST['position_2'] ;
         
    $date_began_2 $_REQUEST['date_began_2'] ;
         
    $date_end_2 $_REQUEST['date_end_2'] ;
         
    $duties_2 $_REQUEST['duties_2'] ;
         
    $salary_required $_REQUEST['salary_required'] ;
         
    $availability $_REQUEST['availability'] ;
         
    $transportation $_REQUEST['transportation'] ;
         
    $certificates $_REQUEST['certificates'] ;
         
       
    $message "";
         
    mail"apply@capital-staffing.com""application",
           
    "$message\n CONTACT INFO:\n Here is my info:\nfull name:$fullname\n contact me at:$phone\n Email:$email\n My Address Is: $street\n $city\n $state\n $postal\nI am interested in $job as my preference to type of work\n\nEmployment History:(employer 1)\n Company: $company_1   Position: $position_1\nDate(start/end): $date_began_1 to $date_end_1\nDuties include: $duties_1\n\nEmployment History:(employer 2)\nCompany: $company_2   Position: $position_2\nDate(start/end): $date_began_2 to $date_end_2\nDuties include: $duties_2\nI am available: $availability\n \n\nMy certificates include: $certificates\nTransportation: $transportation\n\n                Thank you for your time  $fullname""From: $email);
        
    header("Location: http://www.mypage.html");
       
    ?>
    Do this
    PHP Code:
       <?php 
        $fullname 
    $_REQUEST['fullname'] ; 
        
    $phone $_REQUEST['phone'] ; 
        
    $email $_REQUEST['email'] ; 
        
    $street $_REQUEST['street'] ; 
        
    $city $_REQUEST['city'] ; 
        
    $state $_REQUEST['state'] ; 
        
    $postal $_REQUEST['postal'] ; 
        
    $job $_REQUEST['job'] ; 
        
    $company_1 $_REQUEST['company_1'] ; 
        
    $position_1 $_REQUEST['position_1'] ; 
        
    $date_began_1 $_REQUEST['date_began_1'] ; 
        
    $date_end_1 $_REQUEST['date_end_1'] ; 
        
    $duties_1 $_REQUEST['duties_1'] ; 
        
    $company_2 $_REQUEST['company_2'] ; 
        
    $position_2 $_REQUEST['position_2'] ; 
        
    $date_began_2 $_REQUEST['date_began_2'] ; 
        
    $date_end_2 $_REQUEST['date_end_2'] ; 
        
    $duties_2 $_REQUEST['duties_2'] ; 
        
    $salary_required $_REQUEST['salary_required'] ; 
        
    $availability $_REQUEST['availability'] ; 
        
    $transportation $_REQUEST['transportation'] ; 
        
    $certificates $_REQUEST['certificates'] ; 
         
      
    $message =  "$message\n CONTACT INFO:\n Here is my info:\nfull name:$fullname\n contact me at:$phone\n Email:$email\n My Address Is: $street\n $city\n $state\n $postal\nI am interested in $job as my preference to type of work\n\nEmployment History:(employer 1)\n Company: $company_1   Position: $position_1\nDate(start/end): $date_began_1 to $date_end_1\nDuties include: $duties_1\n\nEmployment History:(employer 2)\nCompany: $company_2   Position: $position_2\nDate(start/end): $date_began_2 to $date_end_2\nDuties include: $duties_2\nI am available: $availability\n \n\nMy certificates include: $certificates\nTransportation: $transportation\n\n                Thank you for your time  $fullname"
      
      
    $header "From: $email\r\n" ;
      
    $header .= "Reply-to: Webmaster email <youremail@yourdoamin.com>\r\n";
      
      
    mail"apply@capital-staffing.com""application"$message, ); 
      
      
       
    header("Location: http://www.mypage.html"); 
      
    ?>

  6. #6
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    16,449
    Mentioned
    160 Post(s)
    Tagged
    1 Thread(s)

    Contact Form used to SPAM

    You should do a bit of user input cleaning to make sure the form can't be used to send SPAM. You can use regex to not allow newlines in the $from and to not allow "content-type", "boundary", etc in the $message.
    If you for - header injection - you should be able to get some good example code.

  7. #7
    SitePoint Member
    Join Date
    Aug 2006
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok well seems like the code itself is right but i still the the email web address not the persons email could it be my web host??

  8. #8
    Fully Sweet Car noddy's Avatar
    Join Date
    Aug 2002
    Location
    Perth, Western Australia
    Posts
    759
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you want the users email as the reply to address use

    PHP Code:
      $header .= "Reply-to: $_REQUEST['email']\r\n"


Bookmarks

Posting Permissions

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