CodeIgniter Forums
Error with email class in CI 3.1.8 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17)
+--- Thread: Error with email class in CI 3.1.8 (/showthread.php?tid=70394)

Pages: 1 2 3


RE: Error with email class in CI 3.1.8 - php_rocs - 04-05-2018

@ardavan,

I see no ["appName"] in your CI_Config dump.


RE: Error with email class in CI 3.1.8 - Paradinight - 04-05-2018

(04-05-2018, 12:18 AM)ardavan Wrote: i can't understand what's your mean by $this->email = "examplestring" and attribute $email = "examplestring"
can you please give me a sample code?

even im doing the same on another project with CI 3.1.5 and it works. idk why is not working in 3.1.8 !

The E-Mail Class work on 3.1.8. I have tested it.

PHP Code:
class Example extends CI_Controller {

    function 
__construct() {
        
parent::__construct();
        
        
$this->email 'example'// this is the problem. remove this line
    
}

    public function 
send_example_email()
    {

        
$this->email 'example'// this is the problem. remove this line
        
        /* You E-Mail Code*/
    
}


print the value $this->email


RE: Error with email class in CI 3.1.8 - ardavan - 04-05-2018

@Paradinight

thanks for your highlight I totally forgot that I made that mistake. BUT now I have another issue haha which is valid_mail
Now because of the form validation, I get an error but the email is valid [email protected]


RE: Error with email class in CI 3.1.8 - InsiteFX - 04-06-2018

If I remember right after checking the email class that the valid_email also checks the domain.

look at the code in the email class.


RE: Error with email class in CI 3.1.8 - Paradinight - 04-06-2018

(04-05-2018, 09:31 PM)ardavan Wrote: @Paradinight

thanks for your highlight I totally forgot that I made that mistake. BUT now I have another issue haha which is valid_mail
Now because of the form validation, I get an error but the email is valid [email protected]

Did you write valid_mail or valid_email? Error message?


RE: Error with email class in CI 3.1.8 - InsiteFX - 04-06-2018

If your using validate_email() it calls valid_email() which checks the domain address
that could be why your getting the error message.

SEE: validate_email() and valid_email() in the ./system/libraries/Email.php class.

Even the Form_validation library checks the domain name in valid_email().


RE: Error with email class in CI 3.1.8 - ardavan - 04-06-2018

im using valid_email like this

PHP Code:
$this->form_validation->set_rules('email''lang:valid_email''trim|valid_email|is_unique[USERS.EMAIL]|required'); 



RE: Error with email class in CI 3.1.8 - Paradinight - 04-06-2018

(04-06-2018, 08:31 PM)ardavan Wrote: im using valid_email like this

PHP Code:
$this->form_validation->set_rules('email''lang:valid_email''trim|valid_email|is_unique[USERS.EMAIL]|required'); 

Codeigniter use filter_var does not check if the domain existse. The email is valid. What is the error?
Does the email exist in the user table?


RE: Error with email class in CI 3.1.8 - InsiteFX - 04-07-2018

./system/libraries/Form_validation.php
PHP Code:
    /**
     * Valid Email
     *
     * @param    string
     * @return    bool
     */
    
public function valid_email($str)
    {
        if (
function_exists('idn_to_ascii') && preg_match('#\A([^@]+)@(.+)\z#'$str$matches))
        {
            
$domain defined('INTL_IDNA_VARIANT_UTS46')
                ? 
idn_to_ascii($matches[2], 0INTL_IDNA_VARIANT_UTS46)
                : 
idn_to_ascii($matches[2]);
            
$str $matches[1].'@'.$domain;
        }

        return (bool) 
filter_var($strFILTER_VALIDATE_EMAIL);
    } 

Now you can see that it is checking the email domain.


RE: Error with email class in CI 3.1.8 - ardavan - 04-07-2018

(04-06-2018, 11:53 AM)Paradinight Wrote:
(04-05-2018, 09:31 PM)ardavan Wrote: @Paradinight

thanks for your highlight I totally forgot that I made that mistake. BUT now I have another issue haha which is valid_mail
Now because of the form validation, I get an error but the email is valid [email protected]

Did you write valid_mail or valid_email? Error message?

(04-06-2018, 11:40 PM)Paradinight Wrote:
(04-06-2018, 08:31 PM)ardavan Wrote: im using valid_email like this

PHP Code:
$this->form_validation->set_rules('email''lang:valid_email''trim|valid_email|is_unique[USERS.EMAIL]|required'); 

Codeigniter use filter_var does not check if the domain existse. The email is valid. What is the error?
Does the email exist in the user table?

The error is say the email should be a valid email address