· 8 years ago · Aug 23, 2017, 11:12 AM
1$config = array(
2 'protocol'=>'smtp',
3 'smtp_host'=>'ssl://smtp.googlemail.com',
4 'smtp_port'=>465,
5 'smtp_user'=>'xxx@gmail.com',
6 'smtp_pass'=>'xxx'
7 );
8
9 $this->load->library('email',$config);
10
11 $this->email->set_newline("rn");
12 $this->email->from('xxx@gmail.com', "My Name");
13 $this->email->to($to);
14 $this->email->subject($subject);
15 $this->email->message($message);
16 $this->email->send();
17 return $this->email->print_debugger();
18
19220 smtp.gmail.com ESMTP ci2sm13227458pbc.66 - gsmtp
20
21hello: 250-smtp.gmail.com at your service, [61.4.76.240]
22250-SIZE 35882577
23250-8BITMIME
24250-STARTTLS
25250-ENHANCEDSTATUSCODES
26250-PIPELINING
27250-CHUNKING
28250 SMTPUTF8
29
30Failed to send AUTH LOGIN command. Error: 530 5.7.0 Must issue a STARTTLS command first. ci2sm13227458pbc.66 - gsmtp
31
32from: 530 5.7.0 Must issue a STARTTLS command first. ci2sm13227458pbc.66 - gsmtp
33
34The following SMTP error was encountered: 530 5.7.0 Must issue a STARTTLS command first. ci2sm13227458pbc.66 - gsmtp
35
36to: 530 5.7.0 Must issue a STARTTLS command first. ci2sm13227458pbc.66 - gsmtp
37
38The following SMTP error was encountered: 530 5.7.0 Must issue a STARTTLS command first. ci2sm13227458pbc.66 - gsmtp
39
40data: 530 5.7.0 Must issue a STARTTLS command first. ci2sm13227458pbc.66 - gsmtp
41
42The following SMTP error was encountered: 530 5.7.0 Must issue a STARTTLS command first. ci2sm13227458pbc.66 - gsmtp
43502 5.5.1 Unrecognized command. ci2sm13227458pbc.66 - gsmtp
44The following SMTP error was encountered: 502 5.5.1 Unrecognized command. ci2sm13227458pbc.66 - gsmtp
45Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
46
47User-Agent: CodeIgniter
48Date: Thu, 15 Oct 2015 08:45:28 +0200
49From: "War" <iljimae.ic@gmail.com>
50Return-Path: <iljimae.ic@gmail.com>
51To: iljimae.ic@gmail.com
52Subject: =?utf-8?Q?subject?=
53Reply-To: "iljimae.ic@gmail.com" <iljimae.ic@gmail.com>
54X-Sender: iljimae.ic@gmail.com
55X-Mailer: CodeIgniter
56X-Priority: 3 (Normal)
57Message-ID: <561f4b884c5d7@gmail.com>
58Mime-Version: 1.0
59
60
61Content-Type: text/plain; charset=utf-8
62Content-Transfer-Encoding: 8bit
63
64Every find bro ? I am here for u .
65
66public function some_name() {
67
68 $email = $this->input->post('email');
69
70 $config = Array(
71 'protocol' => 'smtp',
72 'smtp_host' => 'ssl://smtp.googlemail.com',
73 'smtp_port' => 465,
74 'smtp_user' => '*****@gmail.com',
75 'smtp_pass' => '*****',
76 'mailtype' => 'html',
77 'charset' => 'utf-8',
78 'wordwrap' => TRUE
79 );
80
81 /*
82 *
83 * Send email with #temp_pass as a link
84 *
85 */
86
87 $this->load->library('email', $config);
88 $this->email->set_newline("rn");
89 $this->email->from('****@gmail.com', "****");
90 $this->email->to($email);
91 $this->email->subject("***********");
92
93 $message = "<p>Your Account ************</p>";
94 $this->email->message($message);
95 $result = $this->email->send();
96
97}
98
99public function send_email($to, $subject, $message)
100{
101 // Initilize email configuration
102 $config = Array(
103 'protocol' => 'smtp',
104 'smtp_host' => 'intsmtp.abc.com.sg',
105 'mailtype' => 'html',
106 'charset' => 'iso-8859-1',
107 'wordwrap' => TRUE
108 );
109
110 $this->load->library('email', $config);
111 $this->email->set_newline("rn");
112 $this->email->from('ABCMaster');
113 $this->email->to($to);
114 $this->email->subject($subject);
115 $this->email->message($message);
116
117 return ($this->email->send()); // returns TRUE or FALSE
118}
119
120$to = "abc@gmail.com";
121$subject = "Learning ABCs";
122$message = "ABCs are very simple. I am using them now.<br>";
123$message .= "If you would like to learn more, please contact me.";
124
125// Send email
126if ( $this->send_email( $to, $subject, $message ) )
127{
128 // Sending email success
129}
130else
131{
132 // Sending Email has failed
133}
134
135public function sendEmail(){
136 //now copy and paste the below code
137 $this->load->library('email');
138 $html = "Test email";
139 $email_setting = array('mailtype'=>'html');
140 $this->email->initialize($email_setting);
141 $this->email->from('Test');
142 $this->email->to('the email address');
143 $this->email->subject('Title': 'New email');
144 $this->email->message($html);
145 $this->email->send();
146}
147
148$config = array(
149 'protocol' => 'smtp',
150 'smtp_host' => 'mail.google.com',
151 //'smtp_port' => '465',
152 'smtp_timeout' => '7',
153 'smtp_user' => 'info@gmail.com',
154 'smtp_pass' => 'password',
155 'charset' => 'utf-8',
156 'newline' => "rn",
157 'mailtype' => 'html', // or html
158 'wordwrap' => FALSE,
159 'validation' => TRUE // bool whether to validate email or not
160);
161
162$this->load->library('email');
163$this->email->initialize($config);
164$this->email->set_newline("rn");
165$this->email->from($email, 'Subject');
166$this->email->to('nam@gmail.com,nam@gmail.com,nam@gmail.com');
167$this->email->subject('Contact us form by: ' . $name);
168$this->email->message($message . '<br>website:' . $website);
169$this->email->send();
170
171//echo $this->email->print_debugger(); `enter code here`