Hi guys Why does loop
PHP Code:
<?php
namespace App\Controllers;
use App\Models\FormModel;
use CodeIgniter\Controller;
class SendMailController extends Controller
{
public function index()
{
return view('form_view');
}
function sendMail() {
$email = \Config\Services::email();
$to='[email protected]';
$from = $this->request->getVar('mailTo');
$subject = $this->request->getVar('subject');
$email->setTo($to);
$email->setFrom($from, 'Booking Email');
$email->setSubject($subject);
$list= array(
'somo' => $this->request->getPost('somo'),
'message' => $this->request->getPost('message'),/*only output this*/
);
foreach ($list as $key => $value) {
/*not does not loop*/
$mass = $key." : " . $value . "\n";
$email->setMessage($mass);
}
if ($email->send())
{
return redirect()->back()->with('success', 'Email successfully sent');
}
else
{
$data = $email->printDebugger(['headers']);
print_r($data);
}
$config['protocol'] = 'sendmail';
$config['mailPath'] = '/usr/sbin/sendmail';
$config['charset'] = 'iso-8859-1';
$config['wordWrap'] = true;
$config['mailtype'] = 'html';
$email->initialize($config);
}
}
The output of the above code snippet does only shows:
and not does show:
Where is wrong?
Codeigniter First, Codeigniter Then You!!
yekrinaDigitals