【问题标题】:config codeigniter for send email in plesk(parallels)配置用于在 plesk 中发送电子邮件的 codeigniter(并行)
【发布时间】:2015-01-12 07:31:36
【问题描述】:

如何在 plesk 主机中使用 codeigniter 发送电子邮件。我把我的配置放进去 config文件夹下的email.php文件:

    <?php 
    $config['protocol'] = 'smtp';
    $config['smtp_host'] = 'my-domain.com';
    $config['smtp_user'] = 'info@my-domain.com';
    $config['smtp_pass'] = 'my-email-password';
    $config['smtp_port'] = 587;
    $config['mailtype'] = 'html';
    $config['charset'] = 'utf-8';
    $config['priority'] =5;
    $config['wordwrap'] = TRUE;

【问题讨论】:

  • 欢迎来到 Stack Overflow。这不是在这里提问的好方法。到目前为止,您是否尝试过任何方法来解决您的问题?首先展示你的努力,这样人们就可以展示他们的努力。请先阅读FAQHow to Askhelp center

标签: php codeigniter email


【解决方案1】:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends CI_Controller {

/**
 * Index Page for this controller.
 *
 * Maps to the following URL
 *      http://example.com/index.php/welcome
 *  - or -  
 *      http://example.com/index.php/welcome/index
 *  - or -
 * Since this controller is set as the default controller in 
 * config/routes.php, it's displayed at http://example.com/
 *
 * So any other public methods not prefixed with an underscore will
 * map to /index.php/welcome/<method_name>
 * @see http://codeigniter.com/user_guide/general/urls.html
 */
public function index()
{
    //$this->load->view('welcome_message');

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

$this->email->initialize(array(
'protocol' => 'smtp',
'smtp_host' => 'your mail host',
'smtp_user' => 'your mail id',
'smtp_pass' => 'your mail password',
'smtp_port' => port id,
'crlf' => "\r\n",
'newline' => "\r\n"
));

$this->email->from('from mail id', 'Prasanna');
$this->email->to('to mail id');
//$this->email->cc('another@another-example.com');
//$this->email->bcc('them@their-example.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$status = $this->email->send(); 
if($status =='1'){
echo "Success";
}

}
}

/ * End of file welcome.php */
/* Location: ./application/controllers/welcome.php */

【讨论】:

    猜你喜欢
    • 2016-11-02
    • 1970-01-01
    • 2014-07-13
    • 2013-01-07
    • 2019-08-07
    • 1970-01-01
    • 1970-01-01
    • 2017-12-07
    • 1970-01-01
    相关资源
    最近更新 更多