Jump to content

Recommended Posts

$newLine = "\r\n";

// FIRST THING - GRAB THE EMAIL LIST

	$email_pull = mysql_query('SELECT * FROM `mail_list`') or die('There was an error connecting to the database to retrieve the email list');

	// CREATE EMAIL GROUP VARIABLE
	$to = "";

	while($email_results = mysql_fetch_assoc($email_pull))
	{
		$email_address = $email_results['email_address'];
		$name = $email_results['name'];
		$to .= "BCC: $name <$email_address>" . $newLine;

	}

	echo $to;

 

I am trying to build an email list pulled from a database for a newsletter.  When I try to combine name and email address the second variable is always ignored....so for example it should be  BCC: My Name <my@email>.... but that is not what is happening.  What is displaying is:  BCC: My Name.

 

email_address is not blank - if I swap the variables,  email address is displayed and name is ignored.

 

I did discover that if I removed the <> it would work fine...but of course I want to be able to have the name and email address showing in the email client.

 

I have tried this way as well:  "BCC: " . $name . "<" . $email_address . ">" . $newLine;  - I get the same results.

 

Anybody see the error of my ways?

If you are echoing it to the screen, it is because of the < and > they are taken by html as a tag.

 

      echo "<pre>" . $to . "</pre>";

will show it, alternative you could view the source and see it as well.

 

I take it this is for debugging, but if you want it to display in HTML, you can use htmlentities to convert the < and > to it's html code to display properly.

 

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.