mailto question

Discussion in 'HTML & Website Design' started by geekazoid, Jul 22, 2006.

  1. #1
    Could someone tell me how to put a box in my page that has just one line for one email address and when the person clicks send it sends an email to me with their email address on it so i can add it to my mailing list ?
     
    geekazoid, Jul 22, 2006 IP
  2. SexualChocolate

    SexualChocolate Peon

    Messages:
    111
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Assuming you have php on your server... (You will need server side scripting)

    
    <?php
    if(isset($_POST[submit])) {
       mail('YOU@DOMAIN.com','New Email address (this is the subject)',$_POST['email'] . ' would like to be added to the list');
       echo 'Your email has been added';
    } else {
    ?>
    
       <form name="newEmail" action="<?=$_SERVER[PHP_SELF]?>" method="post" >
       <input type="text" name="email" value="" />
       <input type="submit" name="submit" value="Go" />
       </form>
    
    <?php
    }
    ?>
    
    PHP:
    I just wrote this up right now so no guaruntee that its bug free
     
    SexualChocolate, Jul 22, 2006 IP
  3. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #3
    That script is an open invitation to black hats. It would be trivial for anyone to use that script to send whatever to whomever—in other words, to spam the world.

    See http://www.securephpwiki.com/index.php/Email_Injection

    While that article is specific to PHP, it applies to PERL, Python or any other language you might choose.

    Do not use any mail script that hasn't been thoroughly vetted for security issues.

    cheers,

    gary
     
    kk5st, Jul 22, 2006 IP
  4. SexualChocolate

    SexualChocolate Peon

    Messages:
    111
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Youre right, I should have mentioned that but I was just trying to get the basic script for him.
     
    SexualChocolate, Jul 22, 2006 IP
  5. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #5
    I understand. It's just a shame that the email standards, such as rfcs 822, 2821 and 2822 were written and adopted long before spam became an issue. They are sadly lacking in protection against misuse. That puts the onus on the script author, which is more than I can handle.

    @geekazoid: Check out tfmail. People I respect tell me it's a secure script.

    cheers,

    gary
     
    kk5st, Jul 22, 2006 IP
  6. smartconsultant

    smartconsultant Peon

    Messages:
    379
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #6
    <form name="frmName" action="mailto:your@email.id" enctype="text/plain" method="post" >

    <table>
    <tr>
    <td>Your Email :</td>
    <td><input type="text" name="email"></td>
    </tr>
    <tr>
    <td colspan=2><input type="submit" name="submit" value="Submit"></td>
    </tr>
    </table>

    </form>


    Hope it helps !!
     
    smartconsultant, Aug 1, 2006 IP