Menu

send email on page load

Help
chris h
2008-11-22
2013-06-03
  • chris h

    chris h - 2008-11-22

    hi all, i know this is not related directly to a form with a click submit button.

    but i am trying to include in php a script that will send an email when the page is loaded. i was given this code but it doesnt work, i think i forgot a step or something

    <?php mail($to = "admin@clhmedia.com";
    $subject = "new order";
    $message = "you have a new order";

    //mail headers
    $headers = "MIME-Version: 1.0\n";
    $headers .= "Content-type: text/plain; charset=iso-8859-1\n";
    $headers .= "X-Priority: 3\n";
    $headers .= "X-MSMail-Priority: Normal\n";
    $headers .= "X-Mailer: php\n";
    $headers .= "From: \"Admin\" <admin@clhmedia.com>\n";
    $headers .= "Return-Path: admin@clhmedia.com\n";
    $headers .= "Return-Receipt-To: admin@clhmedia.com\n";

    mail($to,$subject,$message,$headers);  ?>

    anyways any help would be great  thanks

     
    • Dave H

      Dave H - 2008-12-15

      Chris,
      you have probably solved your problem by now, but I think the issue is in your first line.

      It should be like this

      <?php
      $to = "admin@clhmedia.com";
      $subject = "new order"; 
      $message = "you have a new order"; 

      Dave

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.