Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2

Thread: Mail App

  1. #1
    Senior Member bluntknife's Avatar
    Join Date
    Jan 2003
    Location
    Bucks UK
    Posts
    288
    Member #
    451
    Hiyaz All,

    I'm currently working to make a mail application for a client of mine.

    Basically, we want to be able to have a mail pipe to check incoming mail to a designated address, then strip out everything from a (plain text) >> END << tag in the body of the message (or if the >> END << tag isn't there, reject the message).

    Then take the resulting message, and update a database with the contents, which should then be called into a scrolling marquee using PHP (or something to that effect.)

    I PM'ed Chen, who was extremely helpful I must add and, with his help, I've managed to get some sort of basis to work on.

    PHP Code:
    $fp fopen('php://stdin''r');
    for (
    $message ''; !feof($fp); $message .= fgets($fp4096));
    fclose($fp);
    if ((
    $endpos strpos($message'>> END <<')) === false) {
        exit;
    }
    $message preg_replace("#\r?\n#""\n"$message);
    $message substr($messagestrpos($message"\n\n"), $endpos);
    INSERT INTO sightings
    VALUES 
    ('$message'
    I thought I'd post in here as I know nowt about PHP and knowing me it's missing half the code. Can anyone give me any pointers of what to do next?

    I don't want to test it on the server yet, just in case it and it brings down the entire site, poisons my fish, dumps my girlfriend, and subscribes me to Train Spotter weekly magazine.

    EDIT: I take it I'll have to set up a Cron Job to run the app every few minutes, or will it run everytime a mail is recieved automatically??

    Thanks very much,
    Ollie
    Hardly the sharpest thing in the drawer.
    Design | Life | Outdoors | Ryukin Radio

  2.  

  3. #2
    Senior Member bluntknife's Avatar
    Join Date
    Jan 2003
    Location
    Bucks UK
    Posts
    288
    Member #
    451
    Update:

    I'm happy, and I haven't even had my 3 cans of caffeine-high coke yet this morning - I've barely touched PHP or SQL before and now I've actually managed to build some stuff that works... I still haven't got the mail pipe set up so I can't test the mail script, but so far I've made the scripts to get the sightings, and set up a cron job to delete all the entries to the database at 12pm every night, both of which work fine

    Can anyone see any errors in the script above before I try and find out for myself?

    Ooh, and also, what are the least perms i can set on a file that is set up for a cron job?

    I want a script to be run but I don't want it to be publically accesible otherwise anyone can delete all the data in the database whenever they want. Any ideas on this one?

    Thanks,
    Ollie
    Hardly the sharpest thing in the drawer.
    Design | Life | Outdoors | Ryukin Radio


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 08:42 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com