Jump to content

hiding email address from mail 'To' column...


rsammy

Recommended Posts

i have an application where i need to send an email within the system. i should not display the email address anywhere in the email.

 

as of now, the way it shows up(on the recipients computer) when i send the email is...

 

From:        ABC Message Center [[email protected]]

To:          [email protected]

Cc:     

Subject:    New Mail from: <Senders Name>

 

<--------- message body here-------->

 

 

how do I prevent the email address from showing up and rather show the name of the recipient?

 

heres my code:

		$row = mysql_fetch_array($result1);
		$to_id = $row["user_id"];

		$query = "SELECT user_email FROM user_mgr WHERE user_id='$userid'";
		$result = mysql_query($query);
		$row = mysql_fetch_array($result);
		$user_email = $row["user_email"];
		$query = "INSERT INTO messages (message,user_id,status,subject,from_p,received,to_email,time_sent) VALUES ('$message_x','$userid','1','$subject','$user_email','$DATE','$to','$TIME')";

		$resultquery= mysql_query($query);
					 	$sentmsg_ID = mysql_insert_id();

		$sentquery = "INSERT INTO sent_messages (user_id, message_id) VALUES ('$userid', '$sentmsg_ID')";
		$resultsent=mysql_query($sentquery);
					$id = mysql_insert_id();

		$headers .= "From: $MCName <$donotreply>\n"; 
		$headers .= "X-Sender: <$donotreply>\n";
		$headers .= "X-Mailer: PHP\n"; // mailer
		$headers .= "X-Priority: 1\n"; // Urgent message!
		$headers .= "Return-Path: <$varreturnpath>\n";  // Return path for errors
		$headers .= 'MIME-Version: 1.0' . "\r\n";
		$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

		$message = $name." has sent a message to you through ABC's message center.  In order to get this message follow this link ".$varurlMC.".

		<p>
					PLEASE DO NOT REPLY TO THIS EMAIL AS THIS IS AN UNATTENDED,
					AUTO GENERATED EMAIL.
		</p>";

		mail($to, "New ABC Mail From: ".$name, $message, $headers);

		header("Location: main.php?m1=".$_POST["m1"]."&d1=".$_POST["d1"]."&y1=".$_POST["y1"]."&m2=".$_POST["m2"]."&d2=".$_POST["d2"]."&y2=".$_POST["y2"]);
		exit;

 

this is how i select the recipient from a drop-down...

                      <tr>
                        <td width="16"> </td>
                        <td width="87"> <div align="right"><b>To:  </b></div></td>
                        <td colspan="2">
                       				<?PHP
								$query="select user_mgr.user_email, user_mgr.user_fname, user_mgr.user_lname
												from user_mgr, phy_det
												where user_mgr.user_id=phy_det.user_id
												AND phy_det.phy_disabled != 'Disable'

												union
												select user_email, user_fname, user_lname
												from user_mgr
												Where operational_user= 'Yes'
												order by user_lname asc, user_fname asc";

										$result= mysql_query ($query);

										if ($result)
										{
											print ("<select name='to'>");

											if ($row = mysql_fetch_array($result))
											  {
											   do
						    					 {

												  	$email_db = $row["user_email"];
												    print("<option value=\"$email_db\"");
													if($from_p == $email_db)
													{
														print(" selected>");
													}
													else
													{
													  	print(">");
													}
												    print $row["user_lname"]; print (", "); print $row["user_fname"];
						  					     	print("</option>");
											   	 }
											   while($row = mysql_fetch_array($result));
											  }
										  }
								             print ("</select>");

									?>

					</td>

				<td colspan="2">
			<?PHP

				$toquery="select user_id, user_lname, user_fname, user_email from user_mgr order by phy_lname, phy_fname";

				$toresult= mysql_query ($toquery);

				if ($toresult)
				{
					print ("<select name='to'>");

					if ($torow = mysql_fetch_array($toresult))
					  {
					   do
    					 {
						    print("<option value=\"");
						    print $torow["user_email"];
							if($from_p == $torow["user_email"])
							{
								print("\" selected>");
							}
							else
							{
							  	print("\">");
							}
						    print $torow["user_lname"]; print (", "); print $torow["user_fname"];
  					     	print("</option>");
					   	 }
					   while($torow = mysql_fetch_array($toresult));
					  }
				  }
		             print ("</select>");
			?>

				</td>

                      </tr>
                      <tr>
                        <td width="16"> </td>
                        <td width="87"> <div align="right"><b>Subject:  </b></div></td>
                        <td colspan="2"> <input  class="txtboxLarge"  type="text" name="subject" value="<?PHP if(isset($subject)){print("RE: ".$subject); } ?>">
                             </td>
                      </tr>
                      <tr>
                        <td width="16"> </td>
                        <td width="87"> <div align="right"><b></b></div></td>
                        <td width="287"> </td>
                        <td width="220"> </td>
                      </tr>
                      <tr>
                        <td width="16"> </td>
                        <td width="87" align="left" valign="top"> <div align="right"><b>Message:  </b></div></td>
                        <td colspan="2" rowspan="4" align="left" valign="top">
                          <textarea class="txtareaLg" name="message" cols="50" rows="15"></textarea>
                        </td>
                      </tr>
                      <tr>
                        <td width="16"> </td>
                        <td width="87"> </td>
                      </tr>

 

how can i use this value in the To field when the recipient views the email rather than show the email address

thanx

Link to comment
https://forums.phpfreaks.com/topic/52557-hiding-email-address-from-mail-to-column/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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