CodeIgniter e-Mail based email method, codeigniteremail_php tutorial

Source: Internet
Author: User
Tags getting started with php codeigniter

CodeIgniter e-Mail based email method, Codeigniteremail


This paper describes the method of e-mail codeigniter based on email. Share to everyone for your reference, as follows:

CodeIgniter has a powerful email class. The following is the code that uses it to send mail.

For more information about CI, please refer to: http://codeigniter.org.cn/user_guide/libraries/email.html

File path is/application/controllers/welcome.php

<?php if (! defined (' BasePath ')) exit (' No Direct script access allowed '); class Welcome extends Ci_co Ntroller {public Function index () {$this->load->library (' email ')//////////The following settings email parameters $config ['    Protocol '] = ' smtp ';    $config [' smtp_host '] = ' smtp.163.com ';    $config [' smtp_user '] = ' fanteathy ';    $config [' smtp_pass '] = ' ****** ';    $config [' smtp_port '] = ' 25 ';    $config [' charset '] = ' utf-8 ';    $config [' wordwrap '] = TRUE;    $config [' mailtype '] = ' html ';    $this->email->initialize ($config);    The following settings email content $this->email->from (' fanteathy@163.com ', ' fanteathy ');    $this->email->to (' 517081935@qq.com ');    $this->email->subject (' email Test ');    $this->email->message (' testing the email class. '); $this->email->attach (' application\controllers\1.jpeg ');    The path relative to index.php $this->email->send (); echo $this->email->print_debugger (); Returns a string containing the contents of the message, including the email header and the email body.  For debugging. }}

After loading the email class, you need to configure the email parameters. Use after configuration is complete

$this->email->initialize ($config)

To initialize the parameters. The contents of the message are then set, and the Last Call

$this->email->send ()

Send the message. Note that if you add an attachment, the address of the attachment is the path to the index.php in the relative CI root directory. The results of the operation are as follows:

More interested in CodeIgniter related content readers can view this site topic: "CodeIgniter Introductory Tutorial", "CI (codeigniter) Framework Advanced Tutorial", "PHP date and Time usage summary", "PHP object-oriented Programming introduction Tutorial", " PHP String Usage Summary, "Getting Started with Php+mysql database operations" and "PHP Common Database Operations Skills Summary"

It is hoped that this article is helpful to the PHP program design based on CodeIgniter framework.

Articles you may be interested in:

    • CodeIgniter How to send HTML messages using the SMTP service
    • CodeIgniter how to send messages and print debug information
    • CodeIgniter How to send a message
    • CodeIgniter implement sending messages with attachments
    • CodeIgniter Page class Pagination use Method Example
    • Analysis of Third_party usage of CodeIgniter Auxiliary third-party class library
    • CodeIgniter Extending Core class examples
    • Setting enhanced configuration class instance for CI (CodeIgniter)
    • PHP implementation of CodeIgniter Shopping cart class
    • CodeIgniter instance of Dom class usage
    • CodeIgniter Shopping Cart class cannot add Chinese solution

http://www.bkjia.com/PHPjc/1117083.html www.bkjia.com true http://www.bkjia.com/PHPjc/1117083.html techarticle CodeIgniter e-mail based on the method of sending email, codeigniteremail The example of this article CodeIgniter based on e-mail class email method. Share to everyone for your reference, as follows: C ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.