Начало Новини Маркет Проекти Форум ИТ Работа Уроци Скриптове WiFi точки Още Вход


Как да изпратите имейл с codeigniter php

От Mutatos / 13.11.2011 12:55
Размер на шрифта: A | A | A

Създайте php имейл кантралер

CODE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
 1.

     
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

  
2.

      

  
3.

     
class Email extends CI_Controller {

  
4.

      

  
5.

         
public function __construct() {

  
6.

      

  
7.

             
parent::__construct();

  
8.

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

  
9.

         
}

 
10.

      

 
11.

         
public function index()

 
12.

         
{

 
13.

             
$this->email->from('youremail@domain.com','your Name');

 
14.

             
$this->email->to('friend@domain.com');

 
15.

             
$this->email->cc('mygirlfriend@domain.com');

 
16.

             
$this->email->bcc('friendgirlfriend@domain.com');

 
17.

             
$this->email->subject('hellow friends');

 
18.

             
$this->email->message('How are you, buddy?');

 
19.

             
$data['title']='Sending email...';

 
20.

             
$data['header']='Sending email now...';

 
21.

             
$data['message']=$this->email->send()?'Message was sent successfully!':'Error sending email!';

 
22.

             
$this->load->view('email_view',$data);

 
23.

         
}

 
24.

     
}

 
25.

      

 
26.

      <!--
more-->

 
27.

      

 
28.

    
/* End of file Email.php */

 
29.

    
/* Location: ./application/controllers/Email.php */



Създадете имейл view.php  за оглед на файла
CODE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
   1.

      <!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  
2.

      <
html xmlns="http://www.w3.org/1999/xhtml">

  
3.

      <
head>

  
4.

      <
meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

   5.

      <title><?php echo $title;?><
/title>

  
6.

      </
head>

  
7.

      <
body>

  
8.

      <
h1><?php echo $header;?></h1>

  
9.

      <
p><?php echo $message;?></p>

 
10.

      </
body>

 
11.

      </
html>

Статистика
Погледнат: пъти
Гласове: --
Оценка:
Действие
 



myTech.bg © 2004 - 2011 | Контакти | За реклама