Mail helper - multiple instances

Hi Everyone,

I'm wanting to use the mail helper to send different emails to multiple addresses. However, I can't seem to figure out how to clear the 'to' array from the mail helper. Every time I use the helper it appends the new address to the existing "to" array.

Can someone advise how to clear out the mail helper, or how to use a fresh instance?

This was mentioned in the following thread, but without any particular solution offered...

Here's the code I'm using...
$mh = Loader::helper('mail');
$mh->from([email protected]');

This code is inside a function which is called multiple times. I have tried unsetting $mh, and have tried assigning Loader::helper('mail') to a new variable. Neither of these seem to work.

View Replies:
Sadu replied on at Permalink Reply
OK, so after an hour trying to figure this out, I post a message on the forum, then 2 mins later I find the solution.

Just replace the first line of code ion my example with the following...
$mh = new MailHelper();
brianvandelden replied on at Permalink Reply
Thanks! Just the answer i was looking for