Send email by using codeigniter library via localhost

前端 未结 3 1877
情深已故
情深已故 2020-12-01 06:59
public function sendemail(){
  $config = Array( 
  \'protocol\' => \'smtp\', 
  \'smtp_host\' => \'ssl://smtp.googlemail.com\', 
  \'smtp_port\' => 465, 
           


        
3条回答
  •  清歌不尽
    2020-12-01 07:25

    $insert = $this->db->insert('email_notification', $data);
                    $this->session->set_flashdata("msg", "
    Cafe has been added Successfully.
    "); //require ("plugins/mailer/PHPMailerAutoload.php"); $mail = new PHPMailer; $mail->SMTPOptions = array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true, ), ); $message=" Your Account Has beed created successfully by Admin: Username: ".$this->input->post('username')."

    Email: ".$this->input->post('sender_email')."

    Regargs
    Bookly Admin.
    "; $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; $subject = "Hello ".$this->input->post('username'); $mail->SMTDebug=2; $email = $this->input->post('sender_email'); //this email is user email $from_label = "Account Creation"; $mail->Username = 'your email'; // SMTP username $mail->Password = 'password'; // SMTP password $mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 465; $mail->setFrom($from_label); $mail->addAddress($email, 'Bookly Admin'); $mail->isHTML(true); $mail->Subject = $subject; $mail->Body = $message; $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; if($mail->send()){ }

提交回复
热议问题