• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
sending email with unknown values

#1
I'm using the email library. When I try to send the values through my form, they do not arrive and do not send the mail because it has no address to send it , can someone help me with this


this is my code:

PHP Code:
public function send_post()
 
   {
 
     //configuracion para gmail
 
     $Name $this->input->post('Name');
 
     $Email  $this->input->post('Email');
 
     $Company  $this->input->post('Company');
 
     $Host $this->input->post('Host');
 
     $fo $this->input->post('fo');
 
     $cc $this->input->post('cc');

 
     $datestring  date('M d Y');
 
     date_default_timezone_set("US/Central");
 
     $time date("h:i a");

 
     $config = array(
 
     'protocol' => 'smtp',
 
     'smtp_host' => 'ssl://smtp.gmail.com',
 
     'smtp_port' => 465,
 
     'mailtype' => 'html',
 
     'smtp_user' => '***********.com',
 
     'smtp_pass' => '*********',
 
     'newline' => "\r\n",
 
    );

 
     //Load email library
 
     $data = array(

 
       'Name'=> $Name,
 
       'Email' => $Email,
 
       'Company' => $Company,
 
       'Host' => $Host,
 
       'Date' => $datestring,
 
       'Time' => $time
          
);

 
     $this->load->library('email',$config);
 
     $this->email->set_newline("\r\n");

 
     $this->email->from('****************''Foreigner');
 
     $this->email->to($fo);
 
     $this->email->cc($cc);
 
     $this->email->subject('Foreigner Visitor System');
 
     $body $this->load->view('email',$data,TRUE);
 
     $this->email->message($body);
 
     $this->email->set_mailtype('html');


 
    if($this->email->send()){
 
      echo "Email was sent successfully";
 
      return true;
 
    }else{
 
      echo "Error, it was not possible to send the email";
 
      $this->email->print_debugger();
 
    }
 } 
Reply

#2
Put this code at the top of your send_post() method:
PHP Code:
echo '<pre>';
print_r($this->input->post());
echo 
'</pre>';
die(); 

Check if the post variable 'fo' has a value.
Reply

#3
is only appear

array(
)
but if i write
$da = $this->post();
vardump ($da);

it show all the information
Reply

#4
Show your form for the input data.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#5
i already made it work

before
$Name = $this->input->post('Name');
$Email = $this->input->post('Email');
$Company = $this->input->post('Company');
$Host = $this->input->post('Host');
$fo = $this->input->post('fo');
$cc = $this->input->post('cc');

after
$Name = $this->post('Name');
$Email = $this->post('Email');
$Company = $this->post('Company');
$Host = $this->post('Host');
$fo = $this->post('fo');
$cc = $this->post('cc');
Reply

#6
Did you manipulate CI's core files? By default, CodeIgniter uses the input library for form data. So $this->input->post(...) should give the correct result, not $this->post.
See https://www.codeigniter.com/user_guide/l...input.html
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.