S
S
Sergey Khlopov2019-11-10 16:55:35
Laravel
Sergey Khlopov, 2019-11-10 16:55:35

Why are there errors when sending email to a local server when the Internet is off?

Hello, tell me please. There is a feedback form on the site, I test sending messages on the local server, if the Internet is on, everything is OK, messages come to the mail. If the Internet is turned off, I get the following error:

[16:46:01] LOG.error: [INVALID UTF-8 DATA]
[16:46:01] LOG.error: Malformed UTF-8 characters, possibly incorrectly encoded {"exception":{}}

And it’s also strange that in my OpenServer (local server) it’s configured that messages should be saved to a folder, but when the Internet is on, messages are sent immediately to the mail, why they are immediately sent to the mail, I don’t quite understand.
Controller method that sends messages:
public function index(Request $request)
    {
        $validator = Validator::make($request->all(), [
            'name' => 'required',
            'phone' => 'required|regex:/^\+?[0-9 \-()]+$/i',
            'email' => 'regex:/\.*[a-z0-9A-Z][email protected]{1}[a-z0-9A-Z]+\.*/i'
        ]);
        if($validator->fails()) {
            $errors = $validator->errors();
            return response()->json([
                'status' => false,
                'body' => array_keys($errors->messages()),
            ]);
        }
        Mail::send(new QuestionShipped($request->all()));
        $msg = new letter();
        $msg->store($request);
        return response()->json([
            'status' => true,
        ]);
    }

Please tell me what could be the problem, thanks in advance for the answer.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question