2

This is my code, I tried smtp_port 587,465, and 25 too. But I'm unable to send an email. And my website is not SSL so I avoid ssl://smtp.googlemail.com instead of I use smtp.googlemail.com and I also tried with ssl://smtp.googlemail.com

public function email()
{
     $config = Array(
        'protocol' => 'smtp',
        'smtp_host' => 'smtp.googlemail.com',
        'smtp_port' => 465,
        'smtp_user' => '******',
        'smtp_pass' => '******',
        'mailtype'  => 'html', 
        'charset'   => 'iso-8859-1'
    );
    $this->load->library('email', $config);
    $this->email->set_newline("\r\n");

    $this->email->from('uvizag@gmail.com', 'Vizag updates');
    $this->email->to('siddharthaesunuri@gmail.com'); 
    $this->email->subject('Activation link...! Vizag updates');
    $msg = "your activation link <a href='base_url'>click here</a>";
    $this->email->message($msg);
    $this->email->send();
    echo $this->email->print_debugger();    
}

How can I solve this ? can you help me please I appreciate your valuable answer

Please click to show my errors

or

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:

A PHP Error was encountered

Severity: Notice

Message: fwrite(): send of 6 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 2172

Backtrace:
Siddhu
  • 241
  • 2
  • 3
  • 16

3 Answers3

2

When I got that error something with my authentication was wrong.

Make sure to disable two step verification or enable access for less secure apps.

This tutorial did the trick for me.

Hope it helps

TrueStory
  • 552
  • 6
  • 13
  • 3
    @Siddhu have you tried setting 'smtp_crypto' => 'ssl' ? – TrueStory Jul 16 '16 at 12:49
  • Yes, I tried @jonas. after that, I get this warning Severity: Warning Message: fsockopen(): unable to connect to ssl://smtp.gmail.com:465 (Connection refused) Filename: libraries/Email.php – Siddhu Jul 17 '16 at 04:09
1

finally, I solved

we need to give google access permissions https://support.google.com/accounts/answer/6010255?hl=en

public function send()
{
    $config = Array(
        'protocol' => 'smtp',
        'smtp_host' => 'ssl://smtp.googlemail.com',
        'smtp_port' => 465,
        'smtp_user' => '****@gmail.com',
        'smtp_pass' => '***',
        'mailtype'  => 'html', 
        'charset'   => 'iso-8859-1'
    );
    $this->load->library('email', $config);
    $this->email->set_newline("\r\n");
    $this->email->from('uvizag@gmail.com', 'admin');
    $this->email->to('siddharthaesunuri@gmail.com, siddhu.php@gmail.com');
    $this->email->subject('Registration Verification:');
    $message = "Thanks for signing up! Your account has been created...!";
    $this->email->message($message);
    if ( ! $this->email->send()) {
        show_error($this->email->print_debugger());
    } 

}
Siddhu
  • 241
  • 2
  • 3
  • 16
0
$config['smtp_crypto'] = 'ssl';
Joundill
  • 6,828
  • 12
  • 36
  • 50
Pankaj Batham
  • 31
  • 1
  • 2