Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Location
    St. Louis
    Posts
    3

    Unanswered: data-driven email onClick event

    Okay, a bit cryptic on the Subject I realize, but it will all make sense what I am trying to do by the end of this message.

    Okay, I have been working on an Extranet application for one of our clients to keep track of their media spending (I work for an advertising firm so media is a big term, lol). Initially this app was really cool, I put together a system in PHP/mySQL that allowed a user to "check out" a file from the database, what basically happened is: the session information that held their login would be updated to the table that held the filename and it would show as being checked out, if a file was checked out the download button was disabled. Even though this is exactly as the client wanted, they thought that the step was too complicated to upload the file (just a browse and submit that updated the file on the server and marked the database entry as null values for being checked out, and updated the date/time).

    So, I was asked to take this functionality out, with regret I did so at once (because the customer is always right). Now, we'd like to have it where when someone downloads a file, we can send an email to specified members of the company (which have a special flag on their records in the auth table). But I have never really had the need to write out php mail functions, so I am a bit lost. The email is simple, just needs to say that the file was downloaded so that we can make a back-up of the original file.

    Any thoughts?

  2. #2
    Join Date
    Jan 2004
    Location
    India
    Posts
    168

    Re: data-driven email onClick event

    The php mail() function is queit simple dear.
    for you it can be something like this:
    in the $header you can specifly the from email as "From : email@email.com", If you want to send HTML mails then you have to add this to your header
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

    mail($toeamil,$subject,$body,$header);

    Rajesh

    Originally posted by cell7dotORG
    Okay, a bit cryptic on the Subject I realize, but it will all make sense what I am trying to do by the end of this message.

    Okay, I have been working on an Extranet application for one of our clients to keep track of their media spending (I work for an advertising firm so media is a big term, lol). Initially this app was really cool, I put together a system in PHP/mySQL that allowed a user to "check out" a file from the database, what basically happened is: the session information that held their login would be updated to the table that held the filename and it would show as being checked out, if a file was checked out the download button was disabled. Even though this is exactly as the client wanted, they thought that the step was too complicated to upload the file (just a browse and submit that updated the file on the server and marked the database entry as null values for being checked out, and updated the date/time).

    So, I was asked to take this functionality out, with regret I did so at once (because the customer is always right). Now, we'd like to have it where when someone downloads a file, we can send an email to specified members of the company (which have a special flag on their records in the auth table). But I have never really had the need to write out php mail functions, so I am a bit lost. The email is simple, just needs to say that the file was downloaded so that we can make a back-up of the original file.

    Any thoughts?

  3. #3
    Join Date
    Feb 2004
    Location
    St. Louis
    Posts
    3

    Re: data-driven email onClick event

    Originally posted by rajesh_r_r
    The php mail() function is queit simple dear.
    for you it can be something like this:
    in the $header you can specifly the from email as "From : email@email.com", If you want to send HTML mails then you have to add this to your header
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

    mail($toeamil,$subject,$body,$header);

    Rajesh
    Will this send an email when a person gets to the page? or only after submit? I am using PHP_SELF for the form action, I suppose if so I could script it to open a window then close it if that's the case.

    Pardon my sheepish n00blike question, I have actually been programming in PHP for a few years, but never had a need for using the mail functions

  4. #4
    Join Date
    Jan 2004
    Location
    India
    Posts
    168

    Thumbs up Re: data-driven email onClick event

    If you want this to be run on page load the it is not a problem you can directly give thins on the top of the page. If you want it to be run on submit the you can check for the submit button been clicked.
    for eg:
    if($submit)
    {
    mail(); an rest wok...
    }
    else
    {
    your normal work without your mail();
    }

    There is no need to open a popup window.
    Rajesh

    Originally posted by cell7dotORG
    Will this send an email when a person gets to the page? or only after submit? I am using PHP_SELF for the form action, I suppose if so I could script it to open a window then close it if that's the case.

    Pardon my sheepish n00blike question, I have actually been programming in PHP for a few years, but never had a need for using the mail functions

Posting Permissions

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