Welcome Guest, Not a member yet? Register   Sign In
Problem sending Email
#1

[eluser]Unknown[/eluser]
Hello,

Please i have issues sending email using CI. I keep getting this error

A PHP Error was encountered

Severity: Notice

Message: fwrite() [function.fwrite]: send of 5 bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: 1789



I really don't understand what the problem is, the site is uploaded to my domain and code looks this this.
Code:
function send_notification($address, $message, $subject)
    {    $CI =& get_instance();
        $CI->load->library('email');
        //ini_set('SMTP', 'smtp.domainname.com');
    
        $config['protocol'] = 'smtp';
        $config['smtp_host'] = "smtp.domainname.com";
        $config['smtp_user'] = "[email protected]";
        $config['smtp_pass'] = "password";
        $config['wordwrap'] = "True";
        
        $CI->email->initialize($config);
        
        $CI->email->from('[email protected]', 'domainname');
        $CI->email->to($address);
            
        $CI->email->subject($subject);
        
        $CI->email->message($message);

        $CI->email->send();
        
        //echo $CI->email->print_debugger();
    }

The smtp server for my domain works well. Please what could be wrong?

Thanks
#2

[eluser]rAponZel[/eluser]
Hi,

I am also getting that kind of error on my uploaded website. Can anyone explain why it occurs?
#3

[eluser]Beginers[/eluser]
trY THIS
Code:
$config = Array(
              'protocol' => 'smtp',
              'smtp_host' => 'ssl://smtp.googlemail.com',
              'validation'=>TRUE,
              'smtp_timeout'=>30,
              'smtp_port' => 465,
              'smtp_user' => '[email protected]', // your email
              'smtp_pass' => 'yourpassword', // your email password
              'mailtype' => 'html',
              'charset' => 'iso-8859-1',
              'wordwrap' => TRUE
            );
            
              $this->load->library('email', $config);
              $this->email->from('[email protected]','Title'); // change it to yours
              $this->email->to('[email protected]'); // change it to yours
              $this->email->subject('Title');
              $this->email->message('Your Message');
             $this->email->send();
#4

[eluser]Krystian[/eluser]
you don`t need to change your script to google mail.

add port to your config array - find out which one is open by your provider ( it can be 465, 587 ...)

add also
Code:
$config['newline']    = "\r\n";
yes double qoutes Smile
#5

[eluser]rAponZel[/eluser]
Thank you Beginers for helping me up clearing my mind out of confuse. I finally understand why this error comes up.

===========================================================================================
A PHP Error was encountered

Severity: Notice

Message: fwrite() [function.fwrite]: send of x bytes failed with errno=32 Broken pipe

Filename: libraries/Email.php

Line Number: xxxx
===========================================================================================

It matters the kind of protocol were using specially on the hosting where our website was hosted. In my case I set the protocol to 'mail' and this is the only configuration I set up for my emailer.

$config['protocol'] = 'mail';





Theme © iAndrew 2016 - Forum software by © MyBB