PHP语言:
临时自用代码
<?php
if (
!
defined(
'BASEPATH'))
exit(
'No direct script access allowed');
class Myemail extends CI_Controller {
function __construct()
{
parent :: __construct();
}
function index()
{
$this -> load -> view( 'welcome_message');
}
function sendmail()
{
//config
$this -> load -> library( 'email');
$config [ 'protocol' ] = 'smtp';
$config [ 'smtp_host' ] = 'ssl://smtp.gmail.com';
$config [ 'smtp_user' ] = 'yourname@gmail.com';
$config [ 'smtp_pass' ] = 'yourpasswd';
$config [ 'smtp_port' ] = '465';
$config [ 'smtp_timeout' ] = '5';
$config [ 'newline' ] = " /r/n ";
$config [ 'crlf' ] = " /r/n ";
$this -> email -> initialize( $config);
$this -> email -> from( 'yourname@gmail.com' , 'yourname');
$this -> email -> to( 'whogetthis@qq.com');
$this -> email -> subject( 'Myemail TT');
$this -> email -> message( 'This is TEST one!');
$this -> email -> send();
}
}
?>
class Myemail extends CI_Controller {
function __construct()
{
parent :: __construct();
}
function index()
{
$this -> load -> view( 'welcome_message');
}
function sendmail()
{
//config
$this -> load -> library( 'email');
$config [ 'protocol' ] = 'smtp';
$config [ 'smtp_host' ] = 'ssl://smtp.gmail.com';
$config [ 'smtp_user' ] = 'yourname@gmail.com';
$config [ 'smtp_pass' ] = 'yourpasswd';
$config [ 'smtp_port' ] = '465';
$config [ 'smtp_timeout' ] = '5';
$config [ 'newline' ] = " /r/n ";
$config [ 'crlf' ] = " /r/n ";
$this -> email -> initialize( $config);
$this -> email -> from( 'yourname@gmail.com' , 'yourname');
$this -> email -> to( 'whogetthis@qq.com');
$this -> email -> subject( 'Myemail TT');
$this -> email -> message( 'This is TEST one!');
$this -> email -> send();
}
}
?>