Exemplo n.º 1
0
    function sendmailto($email, $filename)
    {
        $this->load->library('my_email');
        $subject = 'Permintaan File';
        $message = '<p>This message has been sent for testing purposes.</p> ' . $filename;
        // Get full html:
        $body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=' . strtolower(config_item('charset')) . '" />
    <title>' . html_escape($subject) . '</title>
    <style type="text/css">
        body {
            font-family: Arial, Verdana, Helvetica, sans-serif;
            font-size: 16px;
        }
    </style>
</head>
<body>
' . $message . '
</body>
</html>';
        // Also, for getting full html you may use the following internal method:
        //$body = $this->email->full_html($subject, $message);
        //   	$result = $this->email
        //   	->from('*****@*****.**')
        //   	->reply_to('*****@*****.**')    // Optional, an account where a human being reads.
        //   	->to($email)
        //   	->subject($subject)
        //   	->message($body)
        //   	->send();
        //   	return $result;
        // var_dump($result);
        // echo '<br />';
        // return $this->email->print_debugger();
        // exit;
        $mail = new MY_Email();
        $mail->smtp_host = "smtp.gmail.com";
        $mail->smtp_pass = "******";
        $mail->smtp_user = "******";
        $mail->from('*****@*****.**');
        $mail->to($email);
        //   	$mail->to('*****@*****.**');
        $mail->subject("Perpustakaan P2E : Permintaan Download File");
        $mail->full_html($subject, $message);
        // $mail->body() = $body;
        if ($mail->send()) {
            return TRUE;
        } else {
            return FALSE;
        }
    }