How to Send Email Through Gmail With CodeIgniter

The PHP programming language serves as the foundation for many interactive Web technologies. PHP and PHP frameworks such as CodeIgniter help you create interactive pages by processing user interaction in real time. PHP code can build interactive shopping carts for commercial Web sites, change the presentation of a Web page on the fly, or send emails to other Internet users. The CodeIgniter framework contains a special email class that facilitates the sending of emails through email providers such as Gmail.

Instructions

    • 1

      Create an array that will hold your email configuration settings, in this case your Gmail settings:

      $config = Array(
      'protocol' => 'smtp',
      'smtp_host' => 'ssl://smtp.googlemail.com',
      'smtp_port' => 465,
      'smtp_user' => 'bob@gmail.com', // change it to yours
      'smtp_pass' => 'password', // change it to yours
      'mailtype' => 'html'
      );

    • 2

      Load the library class with your defined configuration options:

      $this->load->library('email', $config);

    • 3

      Construct the email, including subject line and message recipient, and send the message:

      $this->email->from('bob@gmail.com', 'Bob);
      $this->email->to('rob@yahoo.com');
      $this->email->subject('Email Test');
      $this->email->message('Email sent via PHP');

      $this->email->send();

Related Searches:

References

Comments

Related Ads

Featured