php - Sending email with codeigniter (newbie) -
this question has reply here:
send email email class in codeigniter gmail 3 answersi noob in codeigniter , want create contact form , want send gmail. made view:
<div id="content"> <?php if (isset($mail_sent)): ?> <b>mail sent</b> <?php endif; ?> <form action="<?php echo base_url() ?>" method="post"> <b>your name :</b> <br /> <input type="text" name="name" /> <br /> <b>your email address:</b> <br /> <input type="text" name="from" /> <br /> <b>subject :</b> <br /> <input type="text" name="subject" /> <br /> <b>message :</b> <br /> <textarea name="message" rows="10" cols="15"></textarea> <br /> <input type="submit" name="q" value="contact" /> </form> </div>
i have mail service settings in same controller codeblock tahn contact page. looks this:
public function contact() { $this->load->view('header'); $this->load->view('owrb_contact'); $this->load->view('footer'); $config['protocol'] = 'sendmail'; $config['mailpath'] = '/usr/sbin/sendmail'; $config['charset'] = 'iso-8859-1'; // gmail specific settings here $config['smtp_host'] = 'smtp.gmail.com'; $config['smtp_user'] = 'keessonnema@gmail.com'; $config['smtp_pass'] = '123keesje123'; $config['smtp_port'] = '465'; $config['wordwrap'] = true; $this->load->library('email'); $this->email->initialize($config); $this->email->from('keessonnema@gmail.com', 'kees sonnema'); $this->email->subject('email test'); $this->email->message('testing email class.'); $this->email->send(); }
now have configure smtp gmail controller? have no thought of how this.
thanks
you can send mail service codeigniter framework, it's described here.
http://ellislab.com/codeigniter/user-guide/libraries/email.html
there's settings protocol, servers , every item ever wish configurate. can hook gmail if want well.
$config['protocol'] = 'sendmail'; $config['mailpath'] = '/usr/sbin/sendmail'; $config['charset'] = 'iso-8859-1'; // gmail specific settings here $config['smtp_host'] = ''; $config['smtp_user'] = ''; $config['smtp_pass'] = ''; $config['smtp_port'] = ''; $config['wordwrap'] = true; $this->load->library('email'); $this->email->initialize($config); $this->email->from('your@example.com', 'your name'); $this->email->subject('email test'); $this->email->message('testing email class.'); $this->email->send();
php codeigniter email smtp gmail
No comments:
Post a Comment