[Help]automatic mail send

Discussion in 'Programming' started by ofir12, Feb 2, 2010.

  1. #1
    Hello ,

    I want to define mail.php that ever time someone gets in (withput login , just type it on broswer) it will send mail to ..

    The user only needs to see output " mail sent"


    How can it be done ??

    Thank you in advance :) :)
     
    ofir12, Feb 2, 2010 IP
  2. RJP

    RJP Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    <?php
    
    $recipient = 'xx@gmail.com';
    $subject = 'Automatic Email from Page';
    $body = "I just wanted to tell you that somebody visited your auto email page.";
    $header = "FROM: sender@mywebsite.com;"
    
    mail($recipient, $subject, $body, $header);
    
    echo '<p>Mail Sent</p>';
    
    ?>
    PHP:
    Be very careful if your variables are not hard-coded on the page (that is, open to user input) as the mail() function can be abused.

    -Ryan
     
    RJP, Feb 2, 2010 IP