Initial import
This commit is contained in:
63
application/controllers/test/Test_email.php
Normal file
63
application/controllers/test/Test_email.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
class Test_email extends MY_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
function send_email()
|
||||
{
|
||||
$this->load->library("Gmail");
|
||||
$sender = ["email" => "padmanto@sismedika.com", "name" => "P. Kris"];
|
||||
$recipients = [
|
||||
["email" => "padmanto@gmail.com", "name" => "Padmanto"]
|
||||
];
|
||||
$cc = [];
|
||||
$isHtml = true;
|
||||
$attachments = [
|
||||
[
|
||||
"name" => "LapReport.pdf",
|
||||
"url" => "https://devcpone.aplikasi.web.id/birt/run?__report=report/one/mcu/rpt_mcu_history.rptdesign&__format=pdf&PID=5&PPatientID=112&username=adhi&tm=1717726294764"
|
||||
]
|
||||
];
|
||||
$subject = "Percobaan yang pertama";
|
||||
$message = "<h4>Informasi percobaan kedua</h4>.
|
||||
<br/>
|
||||
<table>
|
||||
<tr>
|
||||
<th>No.</th>
|
||||
<th>Nama</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>Joko</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>2</td>
|
||||
<td>Budi</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>3</td>
|
||||
<td>Koko</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br/>
|
||||
Terima Kasih.";
|
||||
|
||||
list($status, $message) = $this->gmail->send(
|
||||
$sender,
|
||||
$subject,
|
||||
$message,
|
||||
$recipients,
|
||||
$cc,
|
||||
$isHtml,
|
||||
$attachments
|
||||
);
|
||||
if ($status) {
|
||||
echo "Email success di kirimkan.";
|
||||
} else {
|
||||
echo "Email gagal di kirimkan. [$message]";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user