Merge pull request #77 from easyrhino/patch-1
Moving foreach($to_array as $to) to just before the self::_notify is necessary to make "message::success" work for multiple recipients. Otherwise, ecard fails with multiple recipients. Also added a trim around the $to so spaces before/after email address don't blow out function, and also reindented the code using Notepad++. Hope this works for the contrib team.
This commit is contained in:
commit
4c66b631c1
@ -40,8 +40,6 @@ class Ecard_Controller extends Controller {
|
||||
}
|
||||
|
||||
if ($valid) {
|
||||
$to_array = explode(",",$form->send_ecard->inputs["to_email"]->value);
|
||||
foreach($to_array as $to) {
|
||||
$v = new View("ecard_email.html");
|
||||
$v->item = $item;
|
||||
$v->subject = module::get_var("ecard", "subject");
|
||||
@ -54,7 +52,7 @@ class Ecard_Controller extends Controller {
|
||||
$v->custom_message = $form->send_ecard->text->value;
|
||||
$v->image = $item->name;
|
||||
$from = $form->send_ecard->inputs["from_email"]->value;
|
||||
$headers = array("from" => $from_name."<".$from.">", "to" => $to, "subject" => module::get_var("ecard", "subject"));
|
||||
|
||||
require_once(MODPATH. "ecard/lib/mime.php");
|
||||
$mime = new Mail_mime("\n");
|
||||
$mime->setHTMLBody($v->render());
|
||||
@ -77,10 +75,14 @@ class Ecard_Controller extends Controller {
|
||||
}
|
||||
}
|
||||
$body = $mime->get(array('html_charset' => 'UTF-8', 'text_charset' => 'UTF-8','text_encoding' => '8bit','head_charset' => 'UTF-8'));
|
||||
|
||||
$to_array = explode(",",$form->send_ecard->inputs["to_email"]->value);
|
||||
foreach($to_array as $to) {
|
||||
$headers = array("from" => $from_name."<".$from.">", "to" => trim($to), "subject" => module::get_var("ecard", "subject"));
|
||||
self::_notify($headers['to'], $headers['from'], $headers['subject'], $item, $body, $mime->headers(), $bcc, $cc);
|
||||
}
|
||||
unlink($tmpfile);
|
||||
message::success("eCard successfully sent");
|
||||
message::success("eCard successfully sent to ".$form->send_ecard->inputs["to_email"]->value);
|
||||
json::reply(array("result" => "success"));
|
||||
} else {
|
||||
json::reply(array("result" => "error", "html" => (string) $form));
|
||||
|
Reference in New Issue
Block a user