Anonymous Email

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post 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
lokesh
Forum Newbie
Posts: 12
Joined: Mon May 23, 2005 9:48 am

Post 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.
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

running which code are you?

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

more details I need...
lokesh
Forum Newbie
Posts: 12
Joined: Mon May 23, 2005 9:48 am

Post 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.
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post 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);
} 
?>
lokesh
Forum Newbie
Posts: 12
Joined: Mon May 23, 2005 9:48 am

Post by lokesh »

Hi,

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

Lokesh.
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post 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.
lokesh
Forum Newbie
Posts: 12
Joined: Mon May 23, 2005 9:48 am

Post 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. :)
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post 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.
lokesh
Forum Newbie
Posts: 12
Joined: Mon May 23, 2005 9:48 am

Post 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?
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post 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.
digitil
Forum Newbie
Posts: 3
Joined: Fri Jul 08, 2005 5:36 pm

what you want is not that hard to do

Post 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/
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

No need to do that with php :) Every decent mail system supports that ;) For example, exim uses /etc/aliases..
Post Reply