Welcome Guest, Not a member yet? Register   Sign In
Email Message Input
#1

[eluser]razerone[/eluser]
Hi.

I would like to know when I receive a email from my website how do I get it to say in message area.

who its is from
there email address
there website
and of course message.

At the moment I have only go displaying message.

on php controller

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Contact extends MX_Controller {

public function index(){

  $this->load->view('header');
  $this->load->view('email');
  $this->load->view('footer');
    }


public function confirmation() {

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


  $this->load->helper('form');

  $this->load->helper('url');

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

  $this->email->subject($this->input->post('email'));
  $this->email->subject($this->input->post('username'));
  $this->email->subject($this->input->post('website'));
  $this->email->subject($this->input->post('subject'));
  $this->email->message($this->input->post('message'));

  if($this->email->send()) {
  
   $this->load->view('header');
   $this->load->view('confirmation');
   $this->load->view('footer');
  }
  else {

   show_error($this->email->print_debugger());

  }
}

on php view

<form role="form" method="post" acti echo base_url('contact/confirmation'); ?>" id="contactus-form-module">
<label for="name">Name</label>
<div class="form-group">
&lt;input class="form-control" type="text" name="name" placeholder="Name"&gt;
</div>
<label for="email"><i class="icon-envelope-alt"></i> Email</label>
<div class="form-group">
&lt;input class="form-control" type="text" name="email" placeholder="Email"&gt;
</div>
<label for="subject"><i class="icon-sun"></i> Website</label>
<div class="form-group">
&lt;input class="form-control" type="text" name="webaddress" placeholder="http://www.example.com/ If Don't Have One Do Not Enter"&gt;
</div>
<label for="subject"><i class="icon-sun"></i> Subject</label>
<div class="form-group">
&lt;input class="form-control" id="focusedInput" type="text" name="subject" placeholder="Place Your Subject Here"&gt;
</div>
<label for="message"><i class="icon-comments"></i> Message</label>
<div class="form-group">
&lt;textarea type="text" class="form-control" rows="10" placeholder="Send Me A Message" name="message"&gt;&lt;/textarea>
</div>
<div class="pager">
<button type="submit" id="contact-form-submit" class="btn btn-primary">Submit</button>
<button type="reset" class="btn btn-danger">Reset</button>
</div>
&lt;/form&gt;
#2

[eluser]jmadsen[/eluser]
1) create your email body as a view

2) $message = $this->load->view('myemailview', $data, true); //true will populate the $message variable

3) $this->email->message($message);
#3

[eluser]razerone[/eluser]
[quote author="jmadsen" date="1382788164"]1) create your email body as a view

2) $message = $this->load->view('myemailview', $data, true); //true will populate the $message variable

3) $this->email->message($message);[/quote]

I have all ready created my email as a view called email is this correct

Code:
public function index(){
  $this->load->view('header');
  $this->load->view('email' , $data, true);
  $this->load->view('footer');
}

Which way should use..


public function confirmation() {

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


  $this->load->helper('form');

  $this->load->helper('url');

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

  $this->email->subject($this->input->post('email'));
  $this->email->subject($this->input->post('username'));
  $this->email->subject($this->input->post('website'));
  $this->email->subject($this->input->post('subject'));
  $this->email->message($this->input->post('message'));
  
   $this->email->message($message);


  if($this->email->send()) {
  
   $this->load->view('header');
   $this->load->view('confirmation');
   $this->load->view('footer');
  }
  else {

   show_error($this->email->print_debugger());

  }
}




Theme © iAndrew 2016 - Forum software by © MyBB