Welcome Guest, Not a member yet? Register   Sign In
Email Class, Google Hosted, SMTP ... no errors, it just takes forever but no email is sent.
#1

[eluser]slapyo[/eluser]
Here is my config file for the email:
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

/*
| -------------------------------------------------------------------------
| Email
| -------------------------------------------------------------------------
| This file lets you define parameters for sending emails.
| Please see the user guide for info:
|
|    http://ellislab.com/codeigniter/user-guide/libraries/email.html
|
*/
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_port'] = 465;
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'password';


/* End of file email.php */
/* Location: ./application/config/email.php */

Here is the code I use to send the email:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class contact extends CI_Controller {

    /**
     * Index Page for this controller.
     *
     * Maps to the following URL
     *         http://example.com/index.php/contact
     *    - or -  
     *         http://example.com/index.php/contact/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/contact/<method_name>
     * @see http://ellislab.com/codeigniter/user-guide/general/urls.html
     */
    public function index()
    {
        $data['userdata'] = array(
            'status' => $this->tank_auth->is_logged_in(),
            'user_id' => $this->tank_auth->get_user_id(),
        );
        
        $this->template->title('Contact');
        $this->template
            ->set_partial('header', 'partials/header')
            ->set_partial('footer', 'partials/footer')
            ->build('contact', $data);
    }
    
    public function send()
    {
        if(!$this->input->post()) {
            redirect('/contact');
        }
        
        $this->form_validation->set_error_delimiters('<span class="help-inline">', '</span>');
        $this->form_validation->set_rules('name', 'Name', 'trim|required');
        $this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
        $this->form_validation->set_rules('message', 'Message', 'trim|required');
        
        if($this->form_validation->run() === false) {
            echo $this->email->print_debugger();
            //$this->index();
        } else {
            $name = $this->input->post('name');
            $email = $this->input->post('email');
            $message = $this->input->post('message');
            
            $this->email->from('[email protected]', 'Sitename');
            $this->email->to('[email protected]');
            $this->email->subject('Contact Form Submission');
            $this->email->message('Name: ' . $name . "\r\nEmail: " . $email . "\r\nMessage: " . $message);
            $this->email->set_alt_message('Name: ' . $name . "\r\nEmail: " . $email . "\r\nMessage: " . $message);
            
            if($this->email->send()) {
                echo $this->email->print_debugger();
            } else {
                echo $this->email->print_debugger();
            }
        }
    }
}

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

Not sure what the problem is. I have been searching all day long and my configuration is set up just like everyone else ... as far as I can tell. Don't know what to try next.




Theme © iAndrew 2016 - Forum software by © MyBB