Jump to content

[SOLVED] Mutlipe emails code help.


Kyle

Recommended Posts

  • Moderators

Hey All,

I'm trying to figure out how can I make this code into multiple emails. I want it to send to different people.

$email = 'whois@email.com';

How can I make this line of code into sending an email to multiple email?

Any help would be great!

Thanks!

Link to comment
Share on other sites

Hi,

Could you accept an array of proposed email addresses and loop through them assigning them to $email and do something with them at the same time?

something like:

foreach ($address as $email)
{
Do Your Stuff... Send Email etc...
}

Just a suggestion, I am assuming you mean you want to send a single email to multiple addresses?

;)

Cheers,

Hey All,

I'm trying to figure out how can I make this code into multiple emails. I want it to send to different people.

$email = 'whois@email.com';

How can I make this line of code into sending an email to multiple email?

Any help would be great!

Thanks!

  • Like 1
Link to comment
Share on other sites

Guest lorathon

the list of emails would need to be placed in the $email array.

Example

$pilots = PilotData::findPilots(array('retired' => 0)); //Retrieves an array of pilots who have a retired column of ZERO


// Loop through the array
foreach($pilots as $pilot) {

   $email = $pilot->email;

   // Do stuff with the email address here (example follows)
   $subject = 'Subject of the email';
   $message = 'The main message of the email';    
   Util::SendEmail($email, $subject, $message);
}

Link to comment
Share on other sites

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.

Loading...
×
×
  • Create New...