Jump to content

mail() function and Bcc field

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
5 replies to this topic

#1
Alhazred

Alhazred

    Learning Programmer

  • Members
  • PipPipPip
  • 99 posts
I need to send the same email in plain text format to several users.
I can do that, but there is a problem: those users who use a gmail account (and only them) can see the email addresses in the Bcc field.

Is there a way to hide those addresses to gmail users?

This is my code

$i=0;

while($row = mysql_fetch_array($addresses)) {

    if($i==0) //first addres into the field To:

        $receiver = $row['email'];

    else //others into Bcc

        $bcc .= $row['email'].", ";

    $i++;

}


$header .= "MIME-Version: 1.0\r\n";

$header .= "Content-type: text; charset=iso-8859-1\r\n";

$header .= "From: My site <email@mysite.com> \r\n";

$header .= "Bcc: ".$bcc."\r\n";

$object = "email's object";

$message = "email's text.\r\n";

mail($receiver, $object, $message, $header);



#2
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
I'd skip mass mailing in one message, and send each user a message instead, directly addressed.
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall

#3
Alhazred

Alhazred

    Learning Programmer

  • Members
  • PipPipPip
  • 99 posts
That's a solution, I know, but I'm on a shared webserver and if I generate a too heavy load, my site will be suspended, so I'm trying to optimize the resources.

#4
BlaineSch

BlaineSch

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,448 posts
Any user can see the BCC when viewing headers - I think some if not more will let you download the entire message revealing the BCC I think.

I would just go with the sending to multiple users - I think most shared servers just notice you if you do a lot at once - put a pause or something in there - or possibly do the first 100 this hour and the next the next hour - or do it alpha or something?

I do not think there is a way around people seeing the BCC...

EDIT:
You could use some method to get the domain of the email - if you dont have many gmail users you could just make a special case for them then add the other ones up and BCC them...?

#5
Alhazred

Alhazred

    Learning Programmer

  • Members
  • PipPipPip
  • 99 posts

BlaineSch said:

You could use some method to get the domain of the email - if you dont have many gmail users you could just make a special case for them then add the other ones up and BCC them...?
This is an intersting solution.

#6
BlaineSch

BlaineSch

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,448 posts
Its performance is based on how many users you have and how many Gmail users you have but if you do not have many compared to the amount of users you should be okay. Not everything has a function for it I suppose sometimes you just have to improvise ^_^