scott_ttocs46 Posted December 4, 2006 Share Posted December 4, 2006 Hi all, I need a script that does this:Connect to mail serverFor each message: Append Entry of Date Sent, Sender, Subject, and Body to XML fileQuit Does anyone have any examples or links??? I am in a bind to get this done and I have no idea how to do it.Example XML:[code]<?xml version="1.0"?><posts><post id="1" replyTo="0"> <title>New Message</title> <author>John Doe</author> <email>[email protected]</email> <date>1/12/2006 01:00:00</date> <text>This is the actual message content.</text></post>[/code]Thanks,ScottEdited for [ code ] tags Link to comment https://forums.phpfreaks.com/topic/29372-please-help-email-to-xml-file/ Share on other sites More sharing options...
scott_ttocs46 Posted December 4, 2006 Author Share Posted December 4, 2006 Also, after it appends the message to the xml files, it needs to delete it from the mail server. Link to comment https://forums.phpfreaks.com/topic/29372-please-help-email-to-xml-file/#findComment-134700 Share on other sites More sharing options...
trq Posted December 4, 2006 Share Posted December 4, 2006 Have you got any code? Link to comment https://forums.phpfreaks.com/topic/29372-please-help-email-to-xml-file/#findComment-134707 Share on other sites More sharing options...
scott_ttocs46 Posted December 4, 2006 Author Share Posted December 4, 2006 I have this for writing the node:[code] function handleSubmit($parSThread, $post, $author, $email, $title, $text, $filePath) { $sThread = $parSThread; $sPost = ""; $newId = $this->getNewId($sThread); $sDate = $this->getIsoDate(); $author = $this->prepareInput($author); $title = $this->prepareInput($title); $email = $this->prepareInput($email); $text = $this->prepareInput($text); $text = str_replace("\r\n", "<br />", $text); $text = str_replace("\r", "<br />", $text); $text = str_replace("\n", "<br />", $text); $sPost .= "\n<post id=\"$newId\" replyTo=\"$post\">\n"; $sPost .= " <title>$title</title>\n"; $sPost .= " <author>$author</author>\n"; $sPost .= " <email>$email</email>\n"; $sPost .= " <date>$sDate</date>\n"; $sPost .= " <text>$text</text>\n"; $sPost .= "</post>"; $sThread = str_replace("</posts>", "$sPost\n</posts>", $sThread); $this->setFileText($filePath, $sThread); echo "<p class=\"note\">Your post has been submitted.</p>"; return $sThread; }[/code]But I do not know how the email would work. Link to comment https://forums.phpfreaks.com/topic/29372-please-help-email-to-xml-file/#findComment-134708 Share on other sites More sharing options...
trq Posted December 4, 2006 Share Posted December 4, 2006 Theres probably not going to be any simple solution Im afraid. Take a look at the [url=http://php.net/imap]imap[/url] functions and the user contributed notes.... might give you some ideas of where to start. Link to comment https://forums.phpfreaks.com/topic/29372-please-help-email-to-xml-file/#findComment-134710 Share on other sites More sharing options...
scott_ttocs46 Posted December 4, 2006 Author Share Posted December 4, 2006 Has the for each message script:http://wiki.cc/php/POP3I am having trouble integrating the two.Also, this looks promising:http://www.phpit.net/article/read-email-php-pop3/ Link to comment https://forums.phpfreaks.com/topic/29372-please-help-email-to-xml-file/#findComment-134711 Share on other sites More sharing options...
scott_ttocs46 Posted December 4, 2006 Author Share Posted December 4, 2006 This is what I have so far:[code]<?phpdl( 'pop3.so' );$pop = new pop3( "server", "user", "password");for ($i=$pop->get_message_count(); $i>0; $i--){//write to xml}?>[/code] Link to comment https://forums.phpfreaks.com/topic/29372-please-help-email-to-xml-file/#findComment-134716 Share on other sites More sharing options...
trq Posted December 4, 2006 Share Posted December 4, 2006 The pop3 function don't look like there going to get you enough infomation. If they did, you could simply put a call to your above function within the loop. eg;[code=php:0]for ($i=$pop->get_message_count(); $i>0; $i--){ handleSubmit($parSThread, $post, $author, $email, $title, $text, $filePath)}[/code]However, the pop3 functions you've ponted out dont supply all the arguments you need. Where ar eyou planning on getting that infomation from? Did you even write the above function? Link to comment https://forums.phpfreaks.com/topic/29372-please-help-email-to-xml-file/#findComment-134717 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.