title: Laravel sending email with shared hosting with cpanel - fails
body: <p>I need to send verification mail to any user who registers on my app. My Laravel version is 5.4.36. I am using shared hosting with cpanel.</p>
  
  <p>So I made an email account through cpanel which should send emails. Here are cpanel's recommended settings:</p>
  
  <p>Username:   rutko@mladensblogger.rs
  Password:   Use the email account’s password.
  Incoming Server:    mail.mladensblogger.rs</p>
  
  <p>IMAP Port: 993 POP3 Port: 995 </p>
  
  <p>Outgoing Server:    mail.mladensblogger.rs</p>
  
  <p>SMTP Port: 465</p>
  
  <p>Here is my .env:</p>
  
  <pre><code>MAIL_DRIVER=smtp
  MAIL_HOST=mail.mladensblogger.rs
  MAIL_PORT=465
  MAIL_USERNAME=rutko@mladensblogger.rs
  MAIL_PASSWORD=myaccountpass
  MAIL_ENCRYPTION=tls
  </code></pre>
  
  <p>Everything looks fine to me, here is the controller where mail sending is needed:</p>
  
  <p>RegisterController.php</p>
  
  <pre><code>public function store(Request $request)
  {
  
      // ************************** -- RULES -- ***************************
  
      $rules = [
          'tbEmail' =&gt; 'required|email|unique:users,email',
          'tbUser' =&gt; 'required|alpha_num|unique:users,user',
          'tbPass' =&gt; 'required|min:6',
          'tbPassConfirm' =&gt; 'required|same:tbPass',
          'tbNameSurname' =&gt; 'required|min:3',
          'tbPhone' =&gt; 'required|regex:/^[0-9]*$/'
      ];
  
      // ************************** -- MESSAGES -- ***************************
  
      $messages = [
          'required' =&gt; 'Polje :attribute je obavezno',
          'same' =&gt; 'Ponovljena lozinka nije ista kao i lozinka',
          'regex' =&gt; ':attribute nije u dozvoljenom formatu',
          'email' =&gt; 'Email nije u dobrom formatu',
          'tbPhone.regex' =&gt; 'Broj telefona mora biti zapisan brojevima i ne sme sadržati slova',
          'tbUser.regex' =&gt; 'Korisničko ime mora početi malim slovom, i ne sme imati razmake',
          'tbNameSurname.min' =&gt; 'Ime nije u ispravnom formatu',
          'min' =&gt; ':attribute mora imati minimum :min karaktera',
          'unique' =&gt; ':attribute je već iskorišćen/a'
      ];
  
      $this-&gt;validate($request, $rules, $messages);
  
      $email = $request-&gt;get('tbEmail');
      $username = $request-&gt;get('tbUser');
      $pass = $request-&gt;get('tbPass');
      $passConfirm = $request-&gt;get('tbPassConfirm');
      $nameSurname = $request-&gt;get('tbNameSurname');
      $phone = $request-&gt;get('tbPhone');
  
      try{
          $user = new User(); // Model for saving the user
          $user-&gt;email = $email;
          $user-&gt;pass = $pass;
          $user-&gt;user = $username;
          $user-&gt;name_surname = $nameSurname;
          $user-&gt;phone = $phone;
  
          $result = $user-&gt;saveWithRegularUserRole();
  
          $verify_user = new VerifyUser();
          $result_for_id = $user-&gt;getByUserAndPass();
          $verify_user-&gt;user_id = $result_for_id-&gt;id;
          $verify_user-&gt;token = str_random(40);
          $verify_user-&gt;create();
  
          //Mail::to($user-&gt;email)-&gt;send(new VerifyMail($user));
  
          if($result == 1){
              return redirect()-&gt;route('index')-&gt;with('success', 'Uspešno ste se registrovali');}
          else{
              return redirect()-&gt;route('index')-&gt;with('error', 'Neuspeh pri registraciji, molimo pokušajte opet!');}
      }
      catch (\Exception $exception){
          \Log::error('Error: ' . $exception-&gt;getMessage());
          return redirect('/')-&gt;with('error', 'Greška pri radu aplikacije, molimo pokušajte ponovo!');
      }
  
  
  }
  </code></pre>
  
  <p>Here is the VerifyMail</p>
  
  <pre><code>class VerifyMail extends Mailable
  {
      use Queueable, SerializesModels;
  
      public $user;
  
      /**
       * Create a new message instance.
       *
       * @return void
       */
      public function __construct($user)
      {
          $this-&gt;user = $user;
      }
  
      /**
       * Build the message.
       *
       * @return $this
       */
      public function build()
      {
          return $this-&gt;view('emails.verifyUser');
      }
  }
  </code></pre>
  
  <p>In my view which is returned after storing the user, if everything passes correctly, a success is shown, othervise, error is shown. Basically mail won't send and view shows error, but when I comment the Mail::toline, a success is shown. I have no ideas, and have tried multiple ways to modify the .env file, maybe the controller is making the problem?</p>