Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Nuxtor's avatar

fwrite(): SSL: Broken pipe / Email

Hi There,

I'm getting following error, when I try to send welcome email with user registration,

ErrorException in StreamBuffer.php line 232:
fwrite(): SSL: Broken pipe

and My Controller is

 /**
     * Create a new user instance after a valid registration.
     *
     * @param  array  $data
     * @return Client
     */
    protected function create(array $data){

       $client = Client::create([
            'name' => $data['name'],
            'telephone' => $data['telephone'],
            'email' => $data['email'],
            'notes' => 'New Account',
            'enabled' => '1',
            'password' => bcrypt($data['password']),
        ]);

       //----------------Send Welcome Email -----------------------------------------
        $data['verification_code']  = $client->verification_code;

        Mail::send('client.email.welcome', $data, function($message) use ($data) {
            $message->from('[email protected]', "Welcome to COS");
            $message->subject("Welcome to COS");
            $message->to($data['email']);
        });

        return  $client;
    }

Please, Can anyone help or advice about this matter ?

Thanks

0 likes
5 replies
JamesSiebert's avatar

Hi :)

I'm also seeing this issue, just wondering if anyone found a solution?

Today it happened after successfully sending 2K emails, then everything after that failed (there was another email task running at the same time). But more commonly it happens just on the first email.

And I think it may have something to do with: Expected response code 250 but got code "451", with message "451 4.4.2 Timeout waiting for data from client. (today the Broken pipe happened about 50 successful emails after this error.. )

I've found a few clues so far:

  • I've found similar solutions (not in Laravel) relating to setting keep-alive = false.
  • Ping timing = 10s, which didn't seem to help.
  • I also have read AWS closes the connection if nothing happens in the 1st 10 seconds.

Will keep digging :)

1 like
GustavoBretas's avatar
Level 1

Hi folks,

I went trough this issues (fwrite(): SSL: Broken pipe) this week, and after investigate a little deeper, I found out that the problem is related to the Rate Limit configured on the smtp server.

So, for who has access to the smtp server, choose a Rate Limit enough to comply with your demand, and for who doens't, may need to work around the rate limit setting a timer to hold the queue when reach the limit

best regards

2 likes

Please or to participate in this conversation.