Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function notify_marketing(){
- $config = Array(
- 'protocol' => 'smtp',
- 'smtp_host' => 'ssl://smtp.googlemail.com',
- 'smtp_port' => 465,
- 'smtp_user' => 'myvalidemail@gmail.com',
- 'smtp_pass' => '*******',//my valid email password
- 'mailtype' => 'html',
- 'charset' => 'iso-8859-1',
- 'wordwrap' => TRUE
- );
- $this->email->initialize($config);
- $this->load->library('email', $config);
- $this->email->set_newline("rn");
- $this->email->from('myvalidemail@gmail.com');
- $this->email->to('validreceiptent@gmail.com');
- $this->email->subject('My Subject');
- $this->email->message('Hello there');
- if($this->email->send())
- {
- $this->session->set_flashdata("success","Email sent.");
- }
- else
- {
- show_error($this->email->print_debugger());
- }
- }
- <div id="exception_error">
- <h1><span class="type">An Error Was Encountered [ 500 ]</span></h1>
- <div class="content">
- <p><p>220 smtp.googlemail.com ESMTP bv4sm16669443pbb.86 - gsmtp
- <br /><pre>hello: 250-smtp.googlemail.com at your service, [110.44.127.179]
- 250-SIZE 35882577
- 250-8BITMIME
- 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN XOAUTH
- 250-ENHANCEDSTATUSCODES
- 250-PIPELINING
- 250-CHUNKING
- 250 SMTPUTF8
- </pre>lang:email_smtp_auth_pw<br />lang:email_send_failure_smtp<br /><pre>User-Agent: CodeIgniter
- Date: Tue, 18 Aug 2015 12:03:42 +0545
- From: <********@gmail.com>
- Return-Path: <********@gmail.com>
- To: *******@gmail.com
- Subject: =?iso-8859-1?Q?My_Subject?=
- Reply-To: "********@gmail.com" <*********@gmail.com>
- X-Sender: *******@gmail.com
- X-Mailer: CodeIgniter
- X-Priority: 3 (Normal)
- Message-ID: <55d2ce42747f5@gmail.com>
- Mime-Version: 1.0
- <?php
- $config['protocol'] = 'smtp';
- $config['smtp_host'] = 'ssl://smtp.gmail.com'; //change this
- $config['smtp_port'] = '465';
- $config['smtp_user'] = 'user@gmail.com'; //change this
- $config['smtp_pass'] = 'password'; //change this
- $config['mailtype'] = 'html';
- $config['charset'] = 'iso-8859-1';
- $config['wordwrap'] = TRUE;
- $config['newline'] = "rn";
- ?>
- <?php
- //send mail
- function sendmail()
- {
- $this->load->library('email'); // load email library
- $this->email->from('user@gmail.com', 'sender name');
- $this->email->to('test1@gmail.com');
- $this->email->cc('test2@gmail.com');
- $this->email->subject('Your Subject');
- $this->email->message('Your Message');
- $this->email->attach('/path/to/file1.png'); // attach file
- $this->email->attach('/path/to/file2.pdf');
- if ($this->email->send())
- echo "Mail Sent!";
- else
- echo "There is error in sending mail!";
- }
- ?>
Add Comment
Please, Sign In to add comment