Jump to content

sending email on multiple selected records


mjohnson025

Recommended Posts

Hi all!

 

I have a page that is used to manage multiple user requests. The problem that I am having, is that it is supposed to send an email to the reporter any time their request is updated from this page. This works fine as long as I am doing one at a time, but when I try to update multiple records it doesn't send the emails. (All other functionality is working fine though.)

Here is a summary of what I have so far:

The form field to pass the users' emails

<input type="hidden" name="user_email<?= $arrValues["mantis_bug_id"] ?>" id="user_email<?= $arrValues["mantis_bug_id"] ?>" value="<?=$arrValues["email"]?>" />

 

This gets passed, along with the rest, to an update case on the same page, where I use a foreach() to process the multiple records:

foreach($_POST['chkResult'] as $intBugID){
.
.
.
.
.
if (isset($_POST["user_email$intBugID"])){
		$emailTo = $_POST["user_email$intBugID"];
		$emailSubject = "Mantis issue $intBugID has been modified.";
		$emailContent = "Mantis issue $intBugID has recently been modified. Please review the changes that have been made 
		here [link]</a><br 
		/>If you have any questions or concerns regarding this issue, please contact Mike or Matt.<br />Thank you,<br />The 
		IT Team.";
		include_once("{$_SERVER['DOCUMENT_ROOT']}/includes/Email.class.php");
		$email = new Email();
		$email->ContentType = "text/html";
		$email->From = "[email protected]";
		$email->FromName = "MOPS Mantis Bugtracker";
		$email->to($emailTo);
		$email->bcc('[email protected]');
		$email->subject($emailSubject);
		$email->setBody($emailContent);
		$email->send;
echo 'User: ' . $emailTo. '<br />';
echo "User Email: " . $emailTo. "<br /><br />";

	}
}//end foreach

 

As I said, this all works fine when I'm processing one issue at a time, but not when doing multiples. All other actions in the foreach() are also working. You'll notice that I'm echoing the username and email at the end for debugging purposes. The interesting thing is, that will output all of the correct usernames and emails for each user, it's just that the $email->send; just isn't working. Needless to say, this has become quite a frustrating bug to fix.

Any help at all is much appreciated!

Thanks,

Mike

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.