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

JustInCase's avatar

Laravel SMTP Error

"message": "Expected response code 220 but got code " ", with message "Unable to init new groups for user 'postfix': Operation not permitted System error 1: Operation not permitted" "

This is what i always face when i try to use mail class

public function resend()
    {
        $to_name = $this->data['user']->username;
        $to_email = $this->data['user']->email;
        $verify_url = url('verify/' . $this->data['user']->remember_token);
        $data = array('verify_url' => $verify_url, 'site_name' => $this->data['site_name'], 'username' => $to_name,);
        Mail::send('others.verify', $data, function ($message) use ($to_name, $to_email) {
            $message->to($to_email, $to_name)
                ->subject('Verify Your Email');
            $message->from(env('MAIL_USERNAME'), $this->data['site_name']);
        });
        session()->flash('message', $this->alert('Resent Verification Mail!', 'success'));
        return redirect()->to('/dashboard');
    }

I tired google smtp , server smtp and elastic mail smtp

MAIL_MAILER=smtp (also tried sendmail )
MAIL_HOST=smtp.elasticemail.com
MAIL_PORT=465 (tried other ports too )
MAIL_USERNAME=From 
MAIL_PASSWORD=MYPASS
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=FROM
MAIL_FROM_NAME="${APP_NAME}"
0 likes
40 replies
Sinnbeck's avatar

I assume you are hiding your username by just writing From? Same with from address

Sinnbeck's avatar

@mrphp ok. I assume they are valid email addresses also?

The only mistake I can spot is the use of env(). You should only use it in config files and then reference those

$message->from(env('MAIL_USERNAME') //bad
$message->from(config('mail.from.address') //good 
JustInCase's avatar

@Sinnbeck i will do it ,

Expected response code 220 but got code " ", with message "Unable to init new groups for user 'postfix': Operation not permitted System error 1: Operation not permitted

why this happens?

Sinnbeck's avatar

@mrphp I have never seen this error before. I assume you mail supplier gives this error for some unknown reason that only they can answer.

Does it work if you just send a test email with hard-coded values?

1 like
JustInCase's avatar

@Sinnbeck i try it in server and its not working , i am assuming it as server problem , but it has nothing to do with server right?

Sinnbeck's avatar

Just to be sure, you are using smtp and you don't have your config cached?

php artisan config:clear 
Sinnbeck's avatar

@mrphp can you answer the last 2 questions? :)

Does it work if you just send a test email with hard-coded values?

Does it work locally with the same credentials?

Sinnbeck's avatar

@mrphp and your env values are 100% identical between local and production?

Did you try asking elasticmail what the error means?

Sinnbeck's avatar

@mrphp can you try running php artisan tinker on the server and run config('mail'). Do you get the expected values?

JustInCase's avatar

@Sinnbeck i tried again "Swift_TransportException with message 'Expected response code 220 but got an empty response'"

Sinnbeck's avatar

@mrphp I am currently drawing a blank. I have never seen the error before and cannot find any hits on Google in regards to sending mails. Currently I am suspecting that it's some weird error on your web server, but I cannot say what

Sinnbeck's avatar

@mrphp can you show the isolated test you are doing now?

I suggest something like this

Route::get('testmail', function () {
    Mail::raw('Hello World!', function($msg) {$msg->to('[email protected]')->subject('Test Email'); });
});
Sinnbeck's avatar

@mrphp really really strange!

Can you post the output of

dd(config('mail.default'));
Sinnbeck's avatar

@mrphp don't suppose you can easily boot up a new server to test with?

Sinnbeck's avatar

@mrphp it might be. Like I said, I have never seen the error before, and can find nothing on Google. So my only suggestion is trial and error sadly

JustInCase's avatar

@Sinnbeck :( , i will try contacting plesk and digitalocean , ig they may have solution

thanks for your time

JustInCase's avatar

@Sinnbeck Address in mailbox given [] does not comply with RFC 2822, 3.6.2.

this is what i am getting now

Sinnbeck's avatar

@mrphp that's because you aren't giving it a valid email somewhere in the code

JustInCase's avatar

@uthoji Address in mailbox given [] does not comply with RFC 2822, 3.6.2.

this is what i am getting now

Please or to participate in this conversation.