Giver samme fejl :/
Har været inde og kigge i php.ini og settings er som følger:
//Ingen ";" foran
extension=php_openssl.dll
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
Har prøvet at semi-kolon local mail server væk også, men virkede heller ikke.
Edit: Smider lige hele mine filer ind og ikke kun funktionen:
Controller:- <?php
-
- class Email extends Controller
- {
- function __construct()
- {
- parent::Controller();
- }
-
- function index()
- {
- $this->load->view('newsletter_view');
- }
-
- function send()
- {
- $this->load->library('form_validation');
-
- //field name, error message, validation rules
- $this->form_validation->set_rules('name', 'Name', 'trim|required');
- $this->form_validation->set_rules('email', 'Email Address', 'trim|required|valid_email');
-
- if($this->form_validation->run() == FALSE)
- {
- $this->load->view('newsletter_view');
- }
- else
- {
- //Validation passed
- $name = $this->input->post('name');
- $email = $this->input->post('email');
-
- $config = array(
- 'smtp_protocol' => 'smtp',
- 'smtp_host' => 'ssl://smtp.gmail.com',
- 'smtp_port' => 465,
- 'smtp_user' => 'mail@gmail.com',
- 'smtp_pass' => 'pw'
- );
-
- $this->load->library('email');
- $this->email->initialize($config);
-
- $this->email->set_newline("r\n");
-
- $this->email->from('mail@gmail.com', 'Dennis ');
- $this->email->to($email);
- $this->email->subject('TEST EMAIL SCRIPT');
- $this->email->message('Hellu, this is a test!');
-
- //Attachment
- $path = $this->config->item('server_root');
- $file = $path . "fw/attachment/test.txt";
-
- $this->email->attach($file);
-
- if($this->email->send())
- {
- echo 'Your email was sent!';
- }
- else
- {
- echo 'nab';
- }
-
- }
-
- }
-
- }
View:- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Form</title>
- <link rel="stylesheet" href='<?php echo base_url(); ?>/css/default.css' type='text/css' media="screen" title="no title" />
- </head>
-
- <body>
- <div id='basic_form'>
- <h2>Newsletter</h2>
- <?php echo form_open('email/send'); ?>
-
- <?php
-
- $name_data = array(
- 'name' => 'name',
- 'id' => 'name',
- 'value' => set_value('name')
- );
-
- $email_data = array(
- 'name' => 'email',
- 'id' => 'email',
- 'value' => set_value('email')
- );
-
- $submit_data = array(
- 'name' => 'submit',
- 'value' => 'submit'
- );
-
- ?>
-
- <p><label for="name">Name:<?php echo form_input($name_data); ?></label></p>
- <p><label for="name">Email Address:<?php echo form_input($email_data); ?></label></p>
- <?php echo form_submit($submit_data); ?>
-
- <?php echo form_close(); ?>
-
- <?php echo validation_errors('<p class=\'error\'>'); ?>
- </div>
- </body>
- </html>
Ingen model page.
Indlæg senest redigeret d. 16.03.2010 23:16 af Bruger #10325