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!';
}
Elevenstech Web Tutorials
Elevenstech Web Tutorials helps you learn coding skills and enhance your skills you want.
As part of Elevenstech's Blog, Elevenstech Web Tutorials contributes to our mission of “helping people learn coding online”.
Read More
Newsletter
Subscribe to get the latest updates from Elevenstech Web Tutorials and stay up to date