The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Double Blind Email System Re: Double Blind Email System


That is an idea that i was toying with, but the client wants it all through email. Right now they have a messaging system in place that doesn’t really work very well on the site, so they want to move it all off-site so they don’t have to deal with it.

I think I’ve come up with a rough idea for code if you guys wanna look through it.

Code below, but also here for easier viewing.

// open IMAP connection for gmail

$mail = imap_open('{}', '[email protected]', 'password');

// grab a list of all the mail headers
$headers = imap_headers($mail);

// make the variable for iterating through the emails
$i = 1;

// this username will be pulled from a database
$username = '[email protected]';

//loop through the email headers
foreach($headers as $header){

// grab the header from the email with the assigned number (numbers are auto assigned by gmail, not sure about other clients)
$header = imap_header($mail, $i);

// grab the body of the email
$body = imap_body($mail, $i);

// grab the subject of the email
$subject = $header->subject;

// grab the from (which comes in as an Array (see below))
$from = $header->from;

// set the date (mainly for checking (see below))
$date = date('H:i', $header->udate);

// grab the from (mailbox is before the @ and host is after the @ so [email protected])
$email = $from[0]->mailbox."@".$from[0]->host;

// subtract one minute from the received date (again, for checking (see below))
$minute = date('i', $date) - 1;

// just for testing to make sure i got the info
echo $email . ' - ' . $subject . ' ' . $minute . '
' ;

// add one to the $i variable to grab the next email

// figure out what the time was one minute ago
$oneminuteago = date('H:i', strtotime('-1 minutes'));

// if the email date is less than or equal to one minute ago, proceed to the next check
if ($date <= $oneminuteago){

// if the username and email match, forward the email (this is for testing, I will grab the username from the database and compare it to the email address in the email)
if ($username == $email){

// real address to forward the email to
$to = '[email protected]';

// set the From: as a unique id ( right now i have a catch-all set up so anything emailed to my name will be received
$headers_mail = 'From: You have a new message from <' . uniqid('user-') . '>' . "rn";

// forward the email
mail($to, $subject, $body, $headers_mail);

// close the connection

What do you think? I know it’s rough and sloppy, but so far it works.