how to send dynamic value in email

how to send dynamic value in email
Posted Jan 28,2021 by umair saleem

1 Answer     520 Views    

how to send dynamic value in email


Elevenstech Jan 28, 2021

public function send()
{

        $sql = $this->db->select('*')->from('table_name')->get()->row();     //fetch data from table


        $to =  '[email protected]';  // User email pass here
        $subject = 'Welcome To Elevenstech';
    
        $from = '[email protected]';              // Pass here your mail id
    
        $emailContent = '<!DOCTYPE><html><head></head><body>';


        $emailContent .= "Hello my name is '".$sql->column_name."'.  Nice to meet you" ;  //   fetch coulm name from the table


        $emailContent .='</body></html>";
                    
    
        $config['protocol'] = 'sendmail';
        $config['smtp_host'] = 'localhost';
        $config['smtp_user']    = 'Enter Your real Gmail id';    //Important
        $config['smtp_pass']    = 'Enter Your Password';  //Important
        $config['smtp_port'] = 25;
         
    
        $this->email->initialize($config);
        $this->email->set_mailtype("html");
        $this->email->from($from);
        $this->email->to($to);
        $this->email->subject($subject);
        $this->email->message($emailContent);
        $this->email->send();
    
        echo'Email Send!';
}

SEARCH POST HERE

Support Us

Subscribe My YouTube Channel

Join Our Telegram Channel & Support Eachother

CATEGORIES

INTERVIEW QUESTIONS

PROJECT SOURCE CODE






POPULAR POSTS