Jump to content

[SOLVED] Email/Newsletter Sending Problem


Grimloch

Recommended Posts

System: PHP-Fusion ver7 CMS

Hello again. I have a newsletter infusion(mod) that works great as is. But I need to modify it so that each recipient is personalized and they don't see all the other users email addresses in the TO: line of the email. No matter how I configure this puppy it still sends emails with all the addresses showing in the To field. My last attempt shown in the code below, was to put the entire 'db query/mail send' routines in a foreach loop. It doesn't work to personalize each email. This is interfacing to the php_mailer mail send function. Any insight would be very much appreciated. The $_POST['sendto'] is an array of email addresses gathered from my multi-select function.

 

 

// New mail send routine for single/multiple user(s)
require_once INFUSIONS."newsletters/newsletters_include.php";
$error = "";
$subject = stripslash($_POST['subject']);
$my_array = ($_POST['sendto']);
if ($_POST['format'] == "plain") {
	$content = stripslash($_POST['content']);
} else if ($_POST['format'] == "html") {
include INFUSIONS."newsletters/include/html_header_include.php";
	$content .= stripslashes($_POST['content'])."\n";
	$content .= "</body>\n</html>\n";
}
_load_PHPMailer();
$mail = new MyMailer;
$mail->Subject = $subject;
if ($_POST['format'] == 'plain') {
	$mail->Body = $content;
} else {
	$mail->AltBody = $locale['nl423'];
	$mail->Body = $content;
  }
foreach ($my_array AS $emails) {
$result = dbquery("SELECT * FROM ".DB_USERS." WHERE user_email='$emails'");
if (dbrows($result)) {
	$rows = dbrows($result); $bcc_list = "";
	while ($data = dbarray($result)) {
		if ($_POST['delivery'] == "bcc") {
			$mail->AddBcc($data['user_email']);
		} else {
			$mail->AddAddress($data['user_email'], $data['user_name']);
			if (!$mail->Send()) {
				$error = $locale['nl417'];
			}
			if ($rows > 1) {
				$mail->ClearAddresses();

			}

		}
	}
}
}

Link to comment
Share on other sites

You know, I don't know if it's the way I put things, the way I ask questions or if people just don't really like to try to deal with mail scripting problems or what. I've noticed that (most people) that pose questions/problems on here get some kind of response within a few hours at the most. So just go ahead and forget about this one. I'll mark it as solved and try to figure it out myself.

 

:-[

Link to comment
Share on other sites

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.