Jump to content

[SOLVED] hiding the receipeint email address while sending email


Recommended Posts

if you go to php.net and search the mail function you will see that the fourth parameter is the one where you include the mail that you put in it. so you can put anything you want.

<?php
//PHP.NET
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" . 
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?> 

 

as you can the th from is where you would put the mail.

No.

 

If you want to hide who is receiving the email then you can't because obviously the person receiving it knows what their email address is and if you don't tell it where to go it can't get there.

 

If you want to send the email to more than one person but don't want the recipients to know who else has received it then you can use BCC

 

If you want to make it so when someone forwards your message it removes the original recipients email address then I would assume that this is down to the mail client of the person forwarding the email, I doubt that you can control this part because it is no longer you sending the email. (Someone feel free to say otherwise if this is not correct).

 

There may be an instruction you can put in the headers for this but I have never heard of it, and it would only be an instruction anyway, the recipients mail client may do as it likes anyway.

 

You can hide who is sending the message by putting whatever you like in the FROM header, but the chances are it will just go straight to the SPAM folder if the FROM field does not relate to the server sending the email.

you need to loop through all recipients and send individual emails each time (your webhost may not like this)

 

as an example:

$recipients = array('email@email.com','email@email.com','email@email.com','email@email.com');
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" . 
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

foreach($recipients as $to){
mail($to, $subject, $message, $headers);
}

see, i need to sent the mail to a mailing list, thats the to address will be the mailing list email address.

now i dont want the receipient to see the mailing list address, as this makes them to send emails using the to address as this.

also the from address will be of the moderator, i wanna hide this also...

 

how can i do bcc

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.