Page 2 of 2

Posted: Tue May 24, 2005 4:13 pm
by Burrito
if you downloaded the php package (not the installer) you should have it already.

you just need to run go-pear

google that term for assistance :D

Posted: Wed May 25, 2005 10:43 am
by lokesh
Hi I have downloaded the modules when I run the code its give the following error

Parse error: parse error, unexpected $ in /home/.....

I check everything I did not find any mistake.

why this is happening?

Lokesh.

Posted: Wed May 25, 2005 1:53 pm
by Burrito
running which code are you?

the code I sent you, or the go-pear code?

more details I need...

Posted: Thu May 26, 2005 10:49 am
by lokesh
Hi,

There was one brack is missing in the if loop. Its solved now.

if ($isunique[0] == 0) ending bracket is missing.....

And getemail() function is not there..... I got this message.....
Fatal error: Call to undefined function: getemail()

Can you upload this function

Thanks,
Lokesh.

Posted: Thu May 26, 2005 11:08 am
by Burrito
doh! sorry...

here you go:

Code: Select all

<?php
function getEmail($structure, $curRtrn = null)
{
  if (!isset($curRtrn))
    $curRtrn = array();
  if ($structure->ctype_primary == 'multipart')
  {
    foreach ($structure->parts as $temp)
    {
      $curRtrn = getEmail($temp, $curRtrn);
    }
  }
  elseif (!isset($structure->ctype_primary) || 
    empty($structure->ctype_primary) && empty($structure->ctype_secondary) || 
    $structure->ctype_primary == 'text' && $structure->ctype_secondary == 'plain')
  {
    $curRtrnї'text'] = $structure->body;
  }
  elseif ($structure->ctype_primary == 'text' && $structure->ctype_secondary == 'html')
  {
    $curRtrnї'html'] = $structure->body;
  }
  else
  {
    if (!isset($curRtrnї'other']))
    {
      $curRtrnї'other'] = array();
    }
    $thisitem = array();
    if (isset($structure->ctype_parametersї'filename']))
    {
      $thisitemї'filename'] = $structure->ctype_parametersї'filename'];
    }
    elseif (isset($structure->ctype_parametersї'name']))
    {
      $thisitemї'filename'] = $structure->ctype_parametersї'name'];
    }
    elseif (isset($structure->d_parametersї'filename']))
    {
      $thisitemї'filename'] = $structure->d_parametersї'filename'];
    }
    else
      $thisitemї'filename'] = &quote;&quote;;
    $thisitemї'type'] = $structure->ctype_primary . '/' . $structure->ctype_secondary;
    $thisitemї'content'] = $structure->body;
    $curRtrnї'other']ї] = $thisitem;
  }
  return $curRtrn;
}

function br2nl( $data ) {
   return preg_replace( '!<br.*>!iU', &quote;\n&quote;, $data );
}

function unhtmlentities ($string)  {
   $trans_tbl = get_html_translation_table (HTML_ENTITIES);
   $trans_tbl = array_flip ($trans_tbl);
   $ret = strtr ($string, $trans_tbl);
   return preg_replace('/&#(\d+);/me', 
     &quote;chr('\\1')&quote;,$ret);
} 
?>

Posted: Thu May 26, 2005 11:31 am
by lokesh
Hi,

Thanks for the code. Email are working!!!. How do I set anon email can you explain please.

Lokesh.

Posted: Thu May 26, 2005 11:43 am
by Burrito
not sure what you mean... but as I suggested in my first post in this thread, you're going to need to craete accounts for every one of the users and then place that account in the reply-to header of the mail you automatically send out. then using the code I gave you, you'll have to pop to the server (for that account) and then dump the info into a database for that specific user. I would tag on a user id when you insert to the database (you'll need to tweak the code I gave you) and then when they hit your site and log in, they can fetch the email stuff from the db according to their user id.

Posted: Thu May 26, 2005 12:00 pm
by lokesh
Yes I got you. But how do I create user accounts dynamically in the mail server using PHP. You have any code? sorry for asking so many questions. :)

Posted: Thu May 26, 2005 12:06 pm
by Burrito
ahh... no I don't have any code for that. My hosting provider (where I colocate my server) has a php interface that allows you to set up virtual mail boxes on a sendmail server so I know it can be done, but I couldn't even begin to tell you how they do it.

check into some c-panel stuff, that might give you a good lead.

Posted: Thu May 26, 2005 12:21 pm
by lokesh
I also use c-panel. We have a seprate interface in C-Panel to create Users. What should I ask my hosting company to do?

Posted: Thu May 26, 2005 12:30 pm
by Burrito
well I suppose you should ask them if you can interface your web with your c-panel to set up mail accounts :?

I can see a potential problem with that though, it needs to be secured somehow...otherwise anyone could create email accounts and you could potentinally end up with a million accounts (on your account) that you don't necessarily want or that you didn't authorize.

my ISP doesn't use "c-panel" they have their own proprietary stuff that they wrote. Talk to your ISP and see if they'd be willing to do something for you...I doubt they will.

what you want is not that hard to do

Posted: Fri Jul 08, 2005 5:46 pm
by digitil
the whole thread is a big misunderstanding about what this guy wants.

he wants this:

1. user sende email to anon_123@website.com, which is associated in a database table with a real email address (the recipient)

2. piped script parses incoming email address, and stores in a database

3. script looks up recipient email address (SELECT realemail FROM emails WHERE id=$id) and sends message to that address, with sender's address as the sender.

You can see this in action on my own site http://www.ashlist.com/

Posted: Fri Jul 08, 2005 6:03 pm
by timvw
No need to do that with php :) Every decent mail system supports that ;) For example, exim uses /etc/aliases..