Welcome Guest, Not a member yet? Register   Sign In
contact doesnt work
#1

[eluser]ChristopherDosin[/eluser]
hey guys

i made a contact form. but i get still no email or an error. did i something wrong?
my contact controller

Code:
<?php

class Contact extends Controller
{

function Contact()
{
  parent::Controller();
  $this->load->helper('form');
  $this->load->helper('email');
  $this->load->library('email');
} // function Contact()

function index()
{
  if($this->input->post('submit') != "")
  {
   $name = (string)$this->input->post('name', TRUE);
   $email = (string)$this->input->post('email', TRUE);
   $subject = (string)$this->input->post('betreff', TRUE);
   $message = (string)$this->input->post('nachricht', TRUE);

   if(empty($name) OR empty($email) OR empty($subject) OR empty($message))
   {
    show_error("Bitte füllen Sie alle Felder aus.");
   }

   if(!valid_email($email))
   {
    show_error("Bitte überprüfen Sie Ihre Email Adresse");
   }

   $config['protocol'] = 'sendmail';
   $this->email->initialize($config);

   $this->email->from($email, $name);
   $this->email->to('[email protected]');

   $this->email->subject($subject);
   $this->email->message($message);

   $this->email->send();

   $data['main_content'] = 'email-success';
   $this->load->view('includes/template', $data);

  }
  else
  {
      $data['main_content'] = 'contact_view';
      $this->load->view('includes/template', $data);
  }
} // function index()
} // class Contact

my contact_view
Code:
<?php echo form_open('contact'); ?>
  <label>Name</label>
  &lt;input type="text" name="name" /&gt;
  <label>Email</label>
  &lt;input type="text" name="email" /&gt;
  <label>Betreff</label>
  &lt;input type="text" name="betreff" /&gt;
  <label>Nachricht</label>
  &lt;textarea rows="10" cols="60" name="nachricht"&gt;&lt;/textarea>
  &lt;input type="submit" name="submit" value="Email senden" /&gt;
  &lt;/form&gt;
#2

[eluser]Ben Edmunds[/eluser]
it looks OK. Make sure your server is setup properly or setup the smtp settings.

Also check the logs.
#3

[eluser]ChristopherDosin[/eluser]
i`ll take a look
#4

[eluser]ChristopherDosin[/eluser]
okay thanks now it`s working

Code:
$config = Array(
    'protocol' => 'smtp',
    'smtp_host' => 'ssl://smtp.googlemail.com',
    'smtp_port' => 465,
    'smtp_user' => '[email protected]',
    'smtp_pass' => '*****'
  );




Theme © iAndrew 2016 - Forum software by © MyBB