snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

SMTP Email failing - error 500

Open elshender opened this issue 11 years ago • 8 comments

Hi, just testing snipe-it. setup went fine, but getting error 500 or if setting-up a new user, an error sending new 'test user's email with credentials. the user is still setup and can login.

when i check /storage/logs I see the following, any help would be appreciated;

[2015-07-21 20:32:12] production.ERROR: exception 'ErrorException' with message 'stream_socket_enable_crypto(): Peer certificate CN=sharedcert.mailhost.net' did not match expected CN=mail.mydomain.com'' in /var/zpanel/hostdata/zadmin/public_html/test_mydomain_com/snipe-it/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:95 Stack trace: #0 [internal function]: Illuminate\Exception\Handler->handleError(2, 'stream_socket_e...', '/var/zpanel/hos...', 95, Array) #1 /var/zpanel/hostdata/zadmin/public_html/test_mydomain_com/snipe-it/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php(95): stream_socket_enable_crypto(Resource id #330, true, 9) #2 /var/zpanel/hostdata/zadmin/public_html/test_mydomain_com/snipe-it/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php(288): Swift_Transport_StreamBuffer->startTLS() #3 /var/zpanel/hostdata/zadmin/public_html/test_mydomain_com/snipe-it/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(118): Swift_Transport_EsmtpTransport->_doHeloCommand() #4 /var/zpanel/hostdata/zadmin/public_html/test_mydomain_com/snipe-it/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php(79): Swift_Transport_AbstractSmtpTransport->start() #5 /var/zpanel/hostdata/zadmin/public_html/test_mydomain_com/snipe-it/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php(329): Swift_Mailer->send(Object(Swift_Message), Array) #6 /var/zpanel/hostdata/zadmin/public_html/test_mydomain_com/snipe-it/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php(151): Illuminate\Mail\Mailer->sendSwiftMessage(Object(Swift_Message)) #7 /var/zpanel/hostdata/zadmin/public_html/test_mydomain_com/snipe-it/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(214): Illuminate\Mail\Mailer->send('emails.forgot-p...', Array, Object(Closure)) #8 /var/zpanel/hostdata/zadmin/public_html/test_mydomain_com/snipe-it/app/controllers/AuthController.php(221): Illuminate\Support\Facades\Facade::__callStatic('send', Array) #9 /var/zpanel/hostdata/zadmin/public_html/test_mydomain_com/snipe-it/app/controllers/AuthController.php(221): Illuminate\Support\Facades\Mail::send('emails.forgot-p...', Array, Object(Closure)) #10 [internal function]: AuthController->postForgotPassword() #11 /var/zpanel/hostdata/zadmin/public_html/test_mydomain_com/snipe-it/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(231): call_user_func_array(Array, Array) #12 /var/zpanel/hostdata/zadmin/public_html/test_mydomain_com/snipe-it/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(93): Illuminate\Routing\Controller->callAction('postForgotPassw...', Array) #13 /var/zpanel/hostdata/zadmin/public_html/test_mydomain_com/snipe-it/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(62): Illuminate\Routing\ControllerDispatcher->call(Object(AuthController), Object(Illuminate\Routing\Route), 'postForgotPassw...') #14 /var/zpanel/hostdata/zadmin/public_html/test_mydomain_com/snipe-it/vendor/laravel/framework/src/Illuminate/Routing/Router.php(967): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'AuthController', 'postForgotPassw...') #15 [internal function]: Illuminate\Routing\Router->Illuminate\Routing{closure}() #16 /var/zpanel/hostdata/zadmin/public_html/test_mydomain_com/snipe-it/vendor/laravel/framework/src/Illuminate/Routing/Route.php(109): call_user_func_array(Object(Closure), Array) #17 /var/zpanel/hostdata/zadmin/public_html/test_mydomain_com/snipe-it/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1033): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request)) #18 /var/zpanel/hostdata/zadmin/public_html/test_mydomain_com/snipe-it/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1001): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request)) #19 /var/zpanel/hostdata/zadmin/public_html/test_mydomain_com/snipe-it/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(775): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request)) #20 /var/zpanel/hostdata/zadmin/public_html/test_mydomain_com/snipe-it/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(745): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request)) #21 /var/zpanel/hostdata/zadmin/public_html/test_mydomain_com/snipe-it/vendor/barryvdh/laravel-debugbar/src/Middleware/Stack.php(34): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true) #22 /var/zpanel/hostdata/zadmin/public_html/test_mydomain_com/snipe-it/vendor/laravel/framework/src/Illuminate/Session/Middleware.php(72): Barryvdh\Debugbar\Middleware\Stack->handle(Object(Illuminate\Http\Request), 1, true) #23 /var/zpanel/hostdata/zadmin/public_html/test_mydomain_com/snipe-it/vendor/laravel/framework/src/Illuminate/Cookie/Queue.php(47): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true) #24 /var/zpanel/hostdata/zadmin/public_html/test_mydomain_com/snipe-it/vendor/laravel/framework/src/Illuminate/Cookie/Guard.php(51): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true) #25 /var/zpanel/hostdata/zadmin/public_html/test_mydomain_com/snipe-it/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true) #26 /var/zpanel/hostdata/zadmin/public_html/test_mydomain_com/snipe-it/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(641): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request)) #27 /var/zpanel/hostdata/zadmin/public_html/test_mydomain_com/snipe-it/public/index.php(49): Illuminate\Foundation\Application->run() #28 {main} [] []

elshender avatar Jul 21 '15 20:07 elshender

Looks related to this issue. https://github.com/swiftmailer/swiftmailer/issues/544

Can you paste your mail.php file here (with user/password obscured)

snipe avatar Jul 21 '15 21:07 snipe

from my mail.php

'from' => array('address' => '[email protected]', 'name' => 'Asset Management'),

/*
|--------------------------------------------------------------------------
| E-Mail Encryption Protocol
|--------------------------------------------------------------------------
|
| Here you may specify the encryption protocol that should be used when
| the application send e-mail messages. A sensible default using the
| transport layer security protocol should provide great security.
|
*/

'encryption' => 'tls',

/*
|--------------------------------------------------------------------------
| SMTP Server Username
|--------------------------------------------------------------------------
|
| If your SMTP server requires a username for authentication, you should
| set it here. This will get used to authenticate with your server on
| connection. You may also set the "password" value below this one.
|
*/

'username' => '[email protected]',

/*
|--------------------------------------------------------------------------
| SMTP Server Password
|--------------------------------------------------------------------------
|
| Here you may set the password required by your SMTP server to send out
| messages from your application. This will be given to the server on
| connection so that the application will be able to send messages.
|
*/

'password' => '***********',

/*
|--------------------------------------------------------------------------
| Sendmail System Path
|--------------------------------------------------------------------------
|
| When using the "sendmail" driver to send e-mails, we will need to know
| the path to where Sendmail lives on this server. A default path has
| been provided here, which will work well on most of your systems.
|
*/

'sendmail' => '/usr/sbin/sendmail -bs',

/*
|--------------------------------------------------------------------------
| Mail "Pretend"
|--------------------------------------------------------------------------
|
| When this option is enabled, e-mail will not actually be sent over the
| web and will instead be written to your application's logs files so
| you may inspect the message. This is great for local development.
|
*/

'pretend' => false,

);

elshender avatar Jul 21 '15 21:07 elshender

It looks like it's having trouble with your SSL cert.

Peer certificate CN=sharedcert.mailhost.net' did not match expected CN=mail.mydomain.com''

Does your shared hosting have an SSL mail server you can use? For example, if I want to use TLS with my Site5 account for one of my domains, I have to use accountname.accountservergroup.com, since the host has a wildcard cert for accountservergroup.com.

If you can tell me who your hosting provider is, I might be able to help you figure out what that should be.

snipe avatar Jul 21 '15 21:07 snipe

we do have an SSL mail server. Mail hosted with www.tierra.net aka domaindiscover.

elshender avatar Jul 21 '15 22:07 elshender

Yeah, so it looks like they don't provide an SSL certificate for you: https://www.tierra.net/faq/email_setup/?

"*You may be prompted to confirm a security exception if you do not have a Secure Sockets Layer (SSL) certificate purchased."

Try changing the driver option to mail maybe? Not sure what restrictions your host might have on sending mail via PHP scripts at the network level, but it's worth a shot.

snipe avatar Jul 21 '15 22:07 snipe

thank you for the help narrowing down the problem. spoken to tierra.net and now have the ssl mail server settings. every thing is now working.

elshender avatar Jul 22 '15 13:07 elshender

Great, glad it's sorted!

sprockets

snipe avatar Jul 25 '15 00:07 snipe

thank you for the help narrowing down the problem. spoken to tierra.net and now have the ssl mail server settings. every thing is now working.

Dear, can you please tell me how did you resolve this issue as I'm facing the same.

SirajQu avatar Apr 28 '19 15:04 SirajQu