0

I am developping a complex website but when I try to deploy it I got an error whenever the website needs to send an email (for the email validation system, built-in with Laravel). The error I got is:

[ErrorException (E_NOTICE)] Undefined offset: 3

The exception seems to be thrown from /vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php.

The only changes I made to config/mail.php is to allow self-signed certificates for ssl. My .env file contains these lines:

MAIL_DRIVER=smtp
MAIL_HOST=localhost
MAIL_PORT=25
MAIL_USERNAME=myusername //match in real file
MAIL_PASSWORD=mypassword //match in real file
MAIL_FROM_ADDRESS=from@mydomain.stackoverflow
MAIL_FROM_NAME=MyAppName
MAIL_ENCRYPTION=tls

My mail server is on the same server (as you could guess with MAIL_HOST=localhost) and is running postfix with Dovecot. I'm also using a webmail app (roundcube) to use my mail server and it works fine (except for OpenDKIM which doesn't sign outcoming mails).

Do you have any idea where my problem can come from?

EDIT: It works with Mailtrap.io so the problems should come fromp the configuration but I don't know if it comes from my Postfix config or from my Laravel config

EDIT2: I still don't understand why but removing credentials works fine. It works with credentials but only if I remove the MAIL_ENCRYPTION option (setting it to null). So here is the working config I have:

MAIL_DRIVER=smtp
MAIL_HOST=localhost
MAIL_PORT=587
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS=from@mydomain.stackoverflow
MAIL_FROM_NAME=MyAppName
MAIL_ENCRYPTION=tls
Alexandre Gérault
  • 323
  • 1
  • 2
  • 13
  • Check the line in the `NTLMAuthenticator` file on which the error throws or post it here. You can read here: `https://stackoverflow.com/questions/2508215/undefined-offset-php-error` what this error is. – thmspl Nov 15 '19 at 16:31
  • "The exception seems to be thrown from..." If an exception is actually being thrown, it will provide you the file and line number, as well as a stack trace showing where in your code the error originates. Check Laravel error log if it's not printed on screen. – miken32 Nov 15 '19 at 21:43

0 Answers0