62 lines
1.3 KiB
PHP
62 lines
1.3 KiB
PHP
<?php
|
|
namespace App\Controllers;
|
|
use CodeIgniter\Controller;
|
|
|
|
class Sendmail extends Controller
|
|
{
|
|
|
|
public function index()
|
|
{
|
|
return view('form_view');
|
|
}
|
|
function Mail_to_donor() {
|
|
|
|
$to = 'gowthamceline46@gmail.com';
|
|
$subject = 'Test';
|
|
$message = 'CI4';
|
|
|
|
$email = \Config\Services::email();
|
|
|
|
$email->setTo($to);
|
|
$email->setFrom('gowtham.manavalan.la@gmail.com', 'Confirm Registration');
|
|
|
|
$email->setSubject($subject);
|
|
$email->setMessage($message);
|
|
|
|
if ($email->send())
|
|
{
|
|
echo 'Email successfully sent';
|
|
}
|
|
else
|
|
{
|
|
$data = $email->printDebugger(['headers']);
|
|
print_r($data);
|
|
}
|
|
|
|
}
|
|
|
|
function sendMail() {
|
|
$to = $this->request->getVar('mailTo');
|
|
$subject = $this->request->getVar('subject');
|
|
$message = $this->request->getVar('message');
|
|
|
|
$email = \Config\Services::email();
|
|
|
|
$email->setTo($to);
|
|
$email->setFrom('johndoe@gmail.com', 'Confirm Registration');
|
|
|
|
$email->setSubject($subject);
|
|
$email->setMessage($message);
|
|
|
|
if ($email->send())
|
|
{
|
|
echo 'Email successfully sent';
|
|
}
|
|
else
|
|
{
|
|
$data = $email->printDebugger(['headers']);
|
|
print_r($data);
|
|
}
|
|
}
|
|
|
|
} |