Php 配置用于在plesk中发送电子邮件的codeigniter(并行)
如何在plesk主机中使用codeigniter发送电子邮件。我把行李放进去了 config文件夹下的email.php文件:Php 配置用于在plesk中发送电子邮件的codeigniter(并行),php,codeigniter,email,Php,Codeigniter,Email,如何在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
<?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;
欢迎来到堆栈溢出。这不是一个好的提问方式。到目前为止,你有没有尝试过解决你的问题?先表现出你的努力,这样人们才能表现出他们的努力。请阅读,并作为一个开始。
<?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 */