Forums

php mail option custom code

ideagrup 21 Jul, 2015
I am trying send multiple emails to database.
Is running OK using this:

CUSTOM CODE In SUBMIT-----
$results = array();
foreach ( $form->data['coles'] as $v ) {
  $to = $v[co_m_director];
  $subject = "My subject";
  $txt = "Hello world!";
  $headers = "From: noreply@programasi.org" . "\r\n";
  mail($to,$subject,$txt,$headers);

But i have two questions:
1. If i send 100 mails can i have problems
2. But i would like show the result at same window one to one.

Like this:
echo $mail . "send to $customer , OK


--- mail send to mail1@domain.com ---
--- mail send to mail2@domain2.com ---
--- mail send to mail3@domain3.com ---

Finish (3 mails sended)
GreyHead 21 Jul, 2015
Hi ideagrup,

1. Possibly, ChronoForms should be OK but you may hit limits on your mail service.

2. In the for each loop, add a value to the $results array and, at the end of the loop, display the results. Something like this:
echo implode("\n", $results);

Bob
This topic is locked and no more replies can be posted.