Dear Mates, Please click the ads to support us.

Email sending isssue

Email sending isssue
Posted Jan 27,2021 by umair saleem

1 Answer     618 Views    

Im not able to send  mail 


Elevenstech Jan 27, 2021

Please use this code to send email. This code is only work on Live server.

public function send()
{
        $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><table width="600px" style="border:1px solid #cccccc;margin: auto;border-spacing:0;"><tr><td style="background:#000000;padding-left:3%"><h4 style="color: #fff;">Elevenstech Web Tutorials</h4></td></tr>';
        $emailContent .='<tr><td style="height:20px"></td></tr>';
    
    
        $emailContent .= 'This is testing';  //   Post message available here
    
    
        $emailContent .='<tr><td style="height:20px"></td></tr>';
        $emailContent .= "<tr><td style='background:#000000;color: #999999;padding: 2%;text-align: center;font-size: 13px;'><p style='margin-top:1px;'><a href='http://elevenstechwebtutorials.com/' target='_blank' style='text-decoration:none;color: #60d2ff;'>www.elevenstechwebtutorials.com</a></p></td></tr></table></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!';
}