Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function sendEnrollment(){
- try {
- $name = $this->input->post('name');
- $email = $this->input->post('mail');
- $institution = $this->input->post('institution');
- $coupon = $this->input->post('coupon');
- $course = $this->input->post('course');
- $mail = new PHPMailer();
- $body = file_get_contents('assets/template/send_enrollment.html');
- $body = preg_replace("{#name#}", $name, $body);
- $body = preg_replace("{#email#}", $email, $body);
- $body = preg_replace("{#cpf#}", $cpf, $body);
- $body = preg_replace("{#coupon#}", $coupon, $body);
- $body = preg_replace("{#course#}", $course, $body);
- $body = preg_replace("{#institution#}", $institution, $body);
- $mail->IsSMTP();
- $mail->SMTPAuth = true;
- $mail->SMTPSecure = "ssl";
- $mail->Host = "br276.hostgator.com.br";
- $mail->Port = 465;
- $mail->Username = "mkt@escolacontrata.com.br";
- $mail->Password = "marketing1";
- $mail->From = "mkt@escolacontrata.com.br";
- $mail->FromName = "Escola Contrata";
- $mail->Subject = 'Cupom de Desconto:' . $course;
- $mail->WordWrap = 50;
- $mail->MsgHTML($body);
- $mail->AddAddress($email, $name);
- $mail->CharSet = "UTF-8";
- $mail->IsHTML(true);
- if($mail->Send()) {
- $error = true;
- } else {
- $error = $mail->ErrorInfo;
- }
- } catch(Exception $e){
- $error = $e->getMessage();
- } finally {
- echo json_encode(array('error' => $error));
- }
- self::sendEnrollmentRedirect();
- }
- private function sendEnrollmentRedirect($param){
- try {
- $name = $this->input->post('name');
- $email = $this->input->post('mail');
- $cpf = $this->input->post('cpf');
- $institution = $this->input->post('institution');
- $institutionMail = $this->input->post('institutionMail');
- $coupon = $this->input->post('coupon');
- $course = $this->input->post('course');
- $state = $this->input->post('state');
- $city = $this->input->post('city');
- $mail = new PHPMailer();
- $body = file_get_contents('assets/template/send_enrollment_redirect.html');
- $body = preg_replace("{#name#}", $name, $body);
- $body = preg_replace("{#email#}", $email, $body);
- $body = preg_replace("{#cpf#}", $cpf, $body);
- $body = preg_replace("{#coupon#}", $coupon, $body);
- $body = preg_replace("{#course#}", $course, $body);
- $body = preg_replace("{#institution#}", $institution, $body);
- $body = preg_replace("{#state#}", $state, $body);
- $body = preg_replace("{#city#}", $city, $body);
- $mail->IsSMTP();
- $mail->SMTPAuth = true;
- $mail->SMTPSecure = "ssl";
- $mail->Host = "br276.hostgator.com.br";
- $mail->Port = 465;
- $mail->Username = "mkt@escolacontrata.com.br";
- $mail->Password = "marketing1";
- $mail->From = "mkt@escolacontrata.com.br";
- $mail->FromName = "Escola Contrata";
- $mail->Subject = 'Cupom de Desconto:' . $course;
- $mail->WordWrap = 50;
- $mail->MsgHTML($body);
- $mail->AddAddress('dop@escolacontrata.com.br', $institution);
- $mail->AddAddress('emerson@dopcomunicacao.com.br', 'Escola Contrata');
- $mail->CharSet = "UTF-8";
- $mail->IsHTML(true);
- if($mail->Send()) {
- $error = true;
- } else {
- $error = $mail->ErrorInfo;
- }
- } catch(Exception $e){
- $error = $e->getMessage();
- } finally {
- echo json_encode(array('error' => $error));
- }
- var_dump($param);
- die;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement