CodeIgniter Forums
Facing issue sending email and input of user - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Facing issue sending email and input of user (/thread-60115.html)



Facing issue sending email and input of user - El Forum - 01-19-2014

[eluser]Unknown[/eluser]
i make simple form user submit email and city submit the form and send email to user of thanks i host website on godaddy, when i submit it shows errors.
1- Sending email error
2- $email input not get
for suggestion i share code.

user.php controller
Code:
public function sendUserMail($email) {
   $this->load->library('email');
   $email = $this->input->get("email");  
   $this->email->from('[email protected]', 'Halalat');
   $this->email->to('$email');
   $this->email->subject('Halalat Newsletter Subscription');
   $this->email->message('Testing');  
   //$this->email->attach('/assests/images/photo1.jpg');
   $this->email->send();
   echo $this->email->print_debugger();
  }

In config i made email.php
Code:
<?php

$config['protocol'] = 'smtp';
$config['smtp_host'] = 'host.abc.com';
$config['smtp_port'] = '465';
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'abc';
$config['charset'] = 'utf-8';
$config['mailtype'] = 'html';
$config['newline'] = "\r\n";

?>

user_model.php in model

Code:
function create_member()
{
   $new_member_insert_data = array(
    'email' => $this->input->post('email'),
    'city' => $this->input->post('city'),      
   );
   $insert = $this->db->insert('users', $new_member_insert_data);
  return $insert;

    
} //create_member



Facing issue sending email and input of user - El Forum - 01-19-2014

[eluser]InsiteFX[/eluser]
It would help if you listed the Email Errors that you are getting.



Facing issue sending email and input of user - El Forum - 01-19-2014

[eluser]CroNiX[/eluser]
For one thing, this line:
Code:
$this->email->to('$email');

You have $email in single quotes, which makes it a literal "$email" string instead of the contents of the variable. Remove the quotes.

Code:
$email = '[email protected]';
echo '$email';
//outputs: $email, not [email protected]