mercredi 15 janvier 2020

getting error swift_transportexception sometime in laravel hosted in AWS

my backend is in laravel, which is hosted on AWS, i am getting strange issue, when i add the user, it send the email with swiftmailer of laravel, mail is working but sometime i am getting error swift_transportexception, here is my fullcode, can anyone please help me to resolve this issue ?

env :

MAIL_DRIVER=smtp
MAIL_HOST=p3plcpn*****.prod.*****.net
MAIL_PORT=465
MAIL_USERNAME=hr@*****.com
MAIL_PASSWORD=*****
MAIL_ENCRYPTION=ssl

Controller :

$subject = "University added.";
                $email = $post['official_email'];
                $name = $post['display_name'];
                $data['official_email'] = $post['official_email'];
                $data['display_name'] = $post['display_name'];
                $data['password'] = $password;

                Mail::send('email.universityadd', $data, function($mail) use ($email, $name, $subject) {
                    $mail->from(getenv('MAIL_USERNAME'), "test");
                    $mail->to($email, $name);
                    $mail->subject($subject);
                });

                if (count(Mail::failures()) > 0) {
                    return response()->json([
                                'success' => true,
                                'message' => 'Email sending to university failed.'
                                    ], 500);
                } else {


                    return response()->json([
                                'success' => true,
                                'message' => "University added successfully"
                                    ], 200);
                }


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2ss3Fik
via IFTTT

Aucun commentaire:

Enregistrer un commentaire