Welcome Guest, Not a member yet? Register   Sign In
Facing issue sending email and input of user
#1

[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
#2

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

[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]




Theme © iAndrew 2016 - Forum software by © MyBB