php - Mailing Service -


i doing project using codeigniter (mobile website). want users receive mails such registration, forgot password, newsletters etc. doing :

function sendemail($email) {         $config = array(             'protocol' => 'smtp',             'smtp_host' => 'ssl://smtp.googlemail.com',             'smtp_port' => '465',             'smtp_user' => 'user@gmail.com',             'smtp_pass' => 'password',             'mailtype'  => 'html',              'charset'   => 'iso-8859-1'             );         $this->load->library('email', $config);         $this->email->set_newline("\r\n");         $this->email->from('user@gmail.com', 'user');         $this->email->to($email);         $this->email->subject('thank registering');         $this->email->message('thank registering .');         if($this->email->send()){             echo "success";         }         else {             echo "failed";         }     } 

this works well. right way of doing things when want send mails of 2-3 types ? please me on this.

i recommend not using gmail smtp web application in production. instead use premium (paid) services www.mailgin.com can use own domain sending, etc. or set own email server.

i recommend using framework sending emails, example www.swiftmailer.org


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -