Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,491 members, 7,819,792 topics. Date: Monday, 06 May 2024 at 11:31 PM

Only For Yawatide,webdezzi,*dhtml, And The Other "guru": - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Only For Yawatide,webdezzi,*dhtml, And The Other "guru": (1004 Views)

DHTML, Or Perhaps Other Developers, I Need You. / :: Dhtml Framework Evolution / My Dhtml Board Games Project :: Featuring Ludo, Snakes And Ladder (2) (3) (4)

(1) (Reply) (Go Down)

Only For Yawatide,webdezzi,*dhtml, And The Other "guru": by internetpo(m): 1:39pm On Nov 27, 2009
hi!

I dropped a support ticket, excuse me a topic earlier in the month

https://www.nairaland.com/nigeria?topic=328746

but havent' seemed to find a solution to it. various reasons for it; time constraints, little expertise, bla bla bla,

I have tried using a pop3 script and i have succeeded in getting it to read the contents of my message but dont seem to get a head way beyond that.

now this is the koko,

I need you guys on NL to help me develop a script (piping, Php or pop3, whatever it is) that can securely access an e-mail and then extract or pour the contents into a database. I know the e-mails will already be in a form of db but i want it to be in another database i will create.

are all these clear or am i speaking gibberish? undecided

Pls i will gladly pay and then of course add some fringe benefits like a ticket to silverbird galleria, a copy of harry porter (or your favorite dream book), Suya/ meat kebab at mallam Musa's (if you haven't tasted mallam musa's suya you have not started eating suya)

and I mean all the above smiley

need help fast.
Re: Only For Yawatide,webdezzi,*dhtml, And The Other "guru": by Nobody: 12:16pm On Nov 28, 2009
I made that solution awhile ago, after reading your post. Contact me asap on diltony@yahoo.com - send an email
I have been lookin for you all these time but it somehow slipped my mind.
Re: Only For Yawatide,webdezzi,*dhtml, And The Other "guru": by internetpo(m): 6:41pm On Dec 08, 2009
any other person out there to help?

I haven't found my solution yet! embarassed
Re: Only For Yawatide,webdezzi,*dhtml, And The Other "guru": by yawatide(f): 7:05pm On Dec 08, 2009
have you done what dhtml said above? undecided undecided

If yes, sorry for the question.
Re: Only For Yawatide,webdezzi,*dhtml, And The Other "guru": by internetpo(m): 7:31pm On Dec 08, 2009
yep!

done that but the guy seems to either be 2 busy or uncooperative. always on the road and u cant pen him down

angry  sad
Re: Only For Yawatide,webdezzi,*dhtml, And The Other "guru": by yawatide(f): 8:07pm On Dec 08, 2009
Interesting. dhtml, what's up now? Too busy to help someone out? cool

sorry about that internetpro. Unfortunately, I haven't written code for what you need and so have no idea where to start.

Hopefully, someone can get back to you soonest. In the meantime, is it possible to see your code? It might help us figure out what you may be missing.

good luck!
Re: Only For Yawatide,webdezzi,*dhtml, And The Other "guru": by sayhi2ay(m): 8:15pm On Dec 08, 2009
risky business -

would you like to send an email attachment to your database?
would you also like to send a virus-email to your database?

If you can read content, sending it to the database should be easy, unless there's something am not thinking about ?
Re: Only For Yawatide,webdezzi,*dhtml, And The Other "guru": by yawatide(f): 8:40pm On Dec 08, 2009
sayhi:
easy to you but obviously not to the poster wink
Re: Only For Yawatide,webdezzi,*dhtml, And The Other "guru": by sayhi2ay(m): 8:56pm On Dec 08, 2009
ok - maybe we can all take a look when he posts the code he has already ?
Re: Only For Yawatide,webdezzi,*dhtml, And The Other "guru": by DualCore1: 9:07pm On Dec 08, 2009
internetpo:

Pls i will gladly pay

See? that's why y'all need me around here. Y'all are so screwed up with codes you cant even recognize a money opportunity presenting itself grin

K, now we know money is involved. . . sayhi and yawa, first to vomit that code. 1,2, ready go!


Umm. . . DHTML said he's got lotsa backlogs he's clearing. So chill smiley
Re: Only For Yawatide,webdezzi,*dhtml, And The Other "guru": by DualCore1: 9:25pm On Dec 08, 2009
Oh i 4got to say this. His present ID is doing time. If u know wht i meanz. wink
Re: Only For Yawatide,webdezzi,*dhtml, And The Other "guru": by joker2k: 6:53am On Dec 09, 2009
Message from dhtml:
I am working on the script, almost completed it. I will try complete and post it today. 95% completed
Re: Only For Yawatide,webdezzi,*dhtml, And The Other "guru": by joker2k: 7:43am On Dec 09, 2009
Completed:

Let us assume your cpanel username is wale

then go to your email forwarders, add a new forwarder and
in the piping option add

|/usr/bin/php -q /home/wale/public_html/mail/pipe.php


It will ask you something about correcting piping problem, just click ok or yes or whatever it shows

then save the piping script to wherever you point it to. i chose to have a mail folder called mail under the public_html



pipe.php
#!/usr/local/bin/php -q
<?php
error_reporting(0);
// read from stdin
$fd = fopen("php://stdin", "r"wink;
$email = "";
while (!feof($fd)) {
$email .= fread($fd, 1024);
}
fclose($fd);





$host="localhost"; //mysql host
$db="mailpipe"; //database
$username="root"; //dbase username
$password="password"; //password

$link = mysql_connect($host, $username, $password);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
// make foo the current db
$db_selected = mysql_select_db($db, $link);
if (!$db_selected) {
die ("Can\'t use $db : " . mysql_error());
}

$message=addslashes("$email"wink; //save the entire email to dbase

mysql_query("insert into msg(message) values('$message')"wink or die(mysql_error());

mysql_close($link);





// handle email
//$email=strip_tags ($email);
$lines = explode("\n", $email);

// empty vars

$from = "";
$subject = "";
$headers = "";
$message = "";
$splittingheaders = true;

for ($i=0; $i < count($lines); $i++) {
if ($splittingheaders) {
// this is a header
$headers .= $lines[$i]."\n";
// look out for special headers
if (preg_match("/^Subject: (.*)/", $lines[$i], $matches)) {
$subject = $matches[1];
}
if (preg_match("/^From: (.*)/", $lines[$i], $matches)) {
$from = $matches[1];
}
} else {
// not a header, but message
$message .= $lines[$i]."\n";
}

if (trim($lines[$i])==""wink {
// empty line, header section has ended
$splittingheaders = false;
}
}

preg_match("/boundary=\".*?\"/i", $headers, $boundary);
$boundaryfulltext = $boundary[0];

if ($boundaryfulltext!=""wink
{
$find = array("/boundary=\"/i", "/\"/i"wink;
$boundarytext = preg_replace($find, "", $boundaryfulltext);
$splitmessage = explode("--" . $boundarytext, $message);
$fullmessage = ltrim($splitmessage[1]);
preg_match('/\n\n(.*)/is', $fullmessage, $splitmore);

if (substr(ltrim($splitmore[0]), 0, 2)=="--"wink
{
$actualmessage = $splitmore[0];
}
else
{
$actualmessage = ltrim($splitmore[0]);
}
}
else
{
$actualmessage = ltrim($message);
}

$clean = array("/\n--.*/is", "/=3D\n.*/s"wink;
$cleanmessage = trim(preg_replace($clean, "", $actualmessage));

// test action to be replaced by db insertion code
$body = "$cleanmessage";



//forward email
mail('diltony@yahoo.com', $subject, $body, "From: ".$from);
?>

The last aspect of that forwarded email can be removed since it is not necessary.
But while testing, you can still leave it there.


The mailpipe database contain only one table:

message
CREATE TABLE IF NOT EXISTS `msg` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`message` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM

This is the first part. From here, you will need an email reader. but use this first, let me see what you can do with it.
Questions are welcome. And i am interested in seeing how this is configured on other servers other than cpanel and bluehost
Re: Only For Yawatide,webdezzi,*dhtml, And The Other "guru": by yawatide(f): 12:27pm On Dec 09, 2009
Very good joker, or is it dhtml? tongue

I have definitely learned something today. Thanks!
Re: Only For Yawatide,webdezzi,*dhtml, And The Other "guru": by joker2k: 3:46pm On Dec 09, 2009
yawa-ti-de:

Very good joker, or is it dhtml? tongue

I have definitely learned something today. Thanks!
you are welcome jor. I hope the OP gets it all sorted out.
I still have plenty of stuffs to do before getting back fully to this board.
Re: Only For Yawatide,webdezzi,*dhtml, And The Other "guru": by internetpo(m): 5:59pm On Dec 11, 2009
thanks man! (and lady)

i am going thru it right no!

u made ma day smiley
Re: Only For Yawatide,webdezzi,*dhtml, And The Other "guru": by internetpo(m): 7:13pm On Dec 11, 2009
Thanks alot *dhtml cheesy
i tried it and it worked. It actually gets to the database but
one problem, the message or body does not come out in full, i mean
only have part of the message. what could be causing that. is it the
email reader you talked about.

expecting your reply.
Re: Only For Yawatide,webdezzi,*dhtml, And The Other "guru": by MyHonour(m): 8:27pm On Dec 11, 2009
Well, the complete version does not come free, berra call me to negotiate, at least i don try small.
Call me on 08120755515
Re: Only For Yawatide,webdezzi,*dhtml, And The Other "guru": by castrolng: 9:09am On Dec 12, 2009
You'll find the reason for "the message or body does not come out in full"
Nice Work *DHTML

The fread() reads from an open file.

The function will stop at the end of the file or when it reaches the specified length, whichever comes first.

This function returns the read string, or FALSE on failure.
Syntax
fread(file,length)

Parameter Description
file Required. Specifies the open file to read from
length Required. Specifies the maximum number of bytes to read

Tips and Notes

Tip: This function is binary-safe (meaning that both binary data, like images, and character data can be written with this function).
Example 1

Read 10 bytes from file:
<?php
$file = fopen("test.txt","r"wink;
fread($file,"10"wink;
fclose($file);
?>

Example 2

Read entire file:
<?php
$file = fopen("test.txt","r"wink;
fread($file,filesize("test.txt"wink);
fclose($file);
?>


As you can see your are reading only 1024 bytes, reminds me of the days of floppy

I think this is my first post on Nairaland all year, Thanks to DHTML solid stuff
Re: Only For Yawatide,webdezzi,*dhtml, And The Other "guru": by MyHonour(m): 12:25pm On Dec 12, 2009
Anyway, lemme give a few hints first:

First, i think that field in the dbase table is text, change it to longtext cause of some long mails.

Then, i once created an application rather like webmail, so i know how to code and decode email.

As in, if you send a full email with yahoo containining like 20 attachments, everything is encoded into a single file.

The code for decoding a full mime email is rather complicated, i can help you with a code to decode an email to get
just the html and possibly the text content. But not attachment.

I cannot release a full email reader, that is a mini application, i cant release that for free, i can only hint on how to
create one if you dont have one already
Re: Only For Yawatide,webdezzi,*dhtml, And The Other "guru": by dhtml15(m): 10:07pm On Dec 12, 2009
The main task of the reader is that you need to read a properly formated MIME email back to text format. It is not as easy as it seems.

(1) (Reply)

Any Good Webdesigner Here / Please Gurus What Should I Do / I Need Help On This Website

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 29
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.