CodeIgniter how to use smtp service to send html mail

Source: Internet
Author: User
Tags codeigniter
This article mainly introduces how CodeIgniter uses the smtp service to send html emails. it involves the use of email in CodeIgniter, for more information about how CodeIgniter uses the smtp service to send html emails, see the following example. Share it with you for your reference. The details are as follows:

The email class provided by codeigniter for sending emails,

Wiki address: http://codeigniter.org.cn/user_guide/libraries/email.html

Summary:

1. the wiki indicates that the configuration file can be submitted separately, and email. php can be placed in the config folder,

The configuration of email. php should be described as follows:

1) generally, the smtp service used for testing, such as 126 and 163 mailboxes all use this protocol, so protocol Selects smtp

2) Enterprise marketing emails are generally html. at this time, you need to configure mailtype as html

In the example, I wrote the email. php configuration file:

<?phpif ( ! defined('BASEPATH')) exit('No direct script access allowed'); /* |------------------------------------ | Email Config |------------------------------------ | by chaichunyan | */ $config['protocol'] = 'smtp';$config['smtp_host'] = 'smtp.126.com';$config['smtp_user'] = 'xxx@126.com';$config['smtp_pass'] = 'xxx';$config['smtp_port'] = '25';$config['charset'] = 'utf-8';$config['wordwrap'] = TRUE;$config['mailtype'] = 'html';

2) the sent html property value uses html, which needs to be processed.

$send_msg = str_replace("\"", "", $msg); $this->email->message($send_msg);  

3) during development, we recommend that you enable the debug information, because if you frequently use 126 of emails,
First, it may be considered as spam, and more importantly, it may be blocked by 126 :(

I hope this article will help you with CodeIgniter-based php programming.

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.