· 8 years ago · Jan 24, 2018, 05:08 PM
1A PHP Error was encountered
2Severity: Warning
3
4Message: strpos(): Empty needle
5
6Filename: libraries/Email.php
7
8Line Number: 944
9
10$this->load->library('email');
11
12 $subject = 'This is a test';
13 $message = '<ul style="list-style-type:none;"><li><p>Name:</p></li></ul>';
14
15 // Get full html:
16 $body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
17 <html xmlns="http://www.w3.org/1999/xhtml">
18 <head>
19 <meta http-equiv="Content-Type" content="text/html; charset=' . strtolower(config_item('charset')) . '" />
20 <title>' . html_escape($subject) . '</title>
21 <style type="text/css">
22 body {
23 font-family: Arial, Verdana, Helvetica, sans-serif;
24 font-size: 16px;
25 }
26 </style>
27 </head>
28 <body>
29 ' . $message . '
30 </body>
31 </html>';
32 // Also, for getting full html you may use the following internal method:
33 //$body = $this->email->full_html($subject, $message);
34// echo $message;die();
35 $result = $this->email
36 ->from('**********@gmail.com')
37 ->reply_to('********@gmail.com') // Optional, an account where a human being reads.
38 ->to('*******@gmail.com')
39 ->subject($subject)
40 ->message($body)
41 ->send();
42
43<?php defined('BASEPATH') OR exit('No direct script access allowed.');
44
45$config['useragent'] = 'PHPMailer'; // Mail engine switcher: 'CodeIgniter' or 'PHPMailer'
46$config['protocol'] = 'mail'; // 'mail', 'sendmail', or 'smtp'
47$config['mailpath'] = '/usr/sbin/sendmail';
48$config['smtp_host'] = 'smtp.gmail.com';
49$config['smtp_user'] = '**********@gmail.com';
50$config['smtp_pass'] = '**********';
51$config['smtp_port'] = 25;
52$config['smtp_timeout'] = 30; // (in seconds)
53$config['smtp_crypto'] = ''; // '' or 'tls' or 'ssl'
54$config['smtp_debug'] = 0; // PHPMailer's SMTP debug info level: 0 = off, 1 = commands, 2 = commands and data, 3 = as 2 plus connection status, 4 = low level data output.
55$config['debug_output'] = ''; // PHPMailer's SMTP debug output: 'html', 'echo', 'error_log' or user defined function with parameter $str and $level. NULL or '' means 'echo' on CLI, 'html' otherwise.
56$config['smtp_auto_tls'] = true; // Whether to enable TLS encryption automatically if a server supports it, even if `smtp_crypto` is not set to 'tls'.
57$config['smtp_conn_options'] = array(); // SMTP connection options, an array passed to the function stream_context_create() when connecting via SMTP.
58$config['wordwrap'] = true;
59$config['wrapchars'] = 76;
60$config['mailtype'] = 'html'; // 'text' or 'html'
61$config['charset'] = null; // 'UTF-8', 'ISO-8859-15', ...; NULL (preferable) means config_item('charset'), i.e. the character set of the site.
62$config['validate'] = true;
63$config['priority'] = 3; // 1, 2, 3, 4, 5; on PHPMailer useragent NULL is a possible option, it means that X-priority header is not set at all, see https://github.com/PHPMailer/PHPMailer/issues/449
64$config['crlf'] = "n"; // "rn" or "n" or "r"
65$config['newline'] = "n"; // "rn" or "n" or "r"
66$config['bcc_batch_mode'] = false;
67$config['bcc_batch_size'] = 200;
68$config['encoding'] = '8bit'; // The body encoding. For CodeIgniter: '8bit' or '7bit'. For PHPMailer: '8bit', '7bit', 'binary', 'base64', or 'quoted-printable'.
69
70// DKIM Signing
71// See https://yomotherboard.com/how-to-setup-email-server-dkim-keys/
72// See http://stackoverflow.com/questions/24463425/send-mail-in-phpmailer-using-dkim-keys
73// See https://github.com/PHPMailer/PHPMailer/blob/v5.2.14/test/phpmailerTest.php#L1708
74$config['dkim_domain'] = ''; // DKIM signing domain name, for exmple 'example.com'.
75$config['dkim_private'] = ''; // DKIM private key, set as a file path.
76$config['dkim_private_string'] = ''; // DKIM private key, set directly from a string.
77$config['dkim_selector'] = ''; // DKIM selector.
78$config['dkim_passphrase'] = ''; // DKIM passphrase, used if your key is encrypted.
79$config['dkim_identity'] = ''; // DKIM Identity, usually the email address used as the source of the email.