Jump to content

PLEASE HELP: EMAIL TO XML FILE


scott_ttocs46

Recommended Posts

Hi all,
    I need a script that does this:

Connect to mail server
For each message:
    Append Entry of Date Sent, Sender, Subject, and Body to XML file
Quit

    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,
Scott

Edited for [ code ] tags
Link to comment
https://forums.phpfreaks.com/topic/29372-please-help-email-to-xml-file/
Share on other sites

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.
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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.