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 = "me@myemail.org";
		$email->FromName = "MOPS Mantis Bugtracker";
		$email->to($emailTo);
		$email->bcc('me@myemail.org');
		$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

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.