Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

email not working in prod although exception storing in db #47

Closed
momame opened this issue Feb 9, 2017 · 13 comments
Closed

email not working in prod although exception storing in db #47

momame opened this issue Feb 9, 2017 · 13 comments

Comments

@momame
Copy link

momame commented Feb 9, 2017

Hi

I configured everything fine and even the exceptions saves in "vendor_tylercd100_lern_exceptions" table. In local-host (xamp server) it simply sends emails without any problem, but not working in prod!

@momame
Copy link
Author

momame commented Feb 14, 2017

can Anyone help???!!!

@tylercd100
Copy link
Owner

Hey Mo,

I'm very sorry but I just got back from vacation yesterday and did not see your request for help until now.

Is your configuration set to use native mail or SMTP?

if smtp is false then you will need to properly install the recommended packages for sending native mail on you production machine
if smtp is true then you will need to properly configure your smtp settings found in config/mail.php

@momame
Copy link
Author

momame commented Feb 15, 2017

Hi Tyler,

I checked config/mail.php It's a SMTP,port25 kind. I set the parameters in lern.php as well.

    /**
     * mail, pushover, slack, etc...
     */
    'drivers'=>['mail'],

    /**
     * Mail settings
     */
    'mail'=>[
        'to'   => '[email protected]',
        'from' => '[email protected]',
        'smtp' => true,
    ],

what else should I do?

@tylercd100
Copy link
Owner

What version of Laravel are you using?
What are you using for your SMTP server?
Have you tried using a tool like https://mailtrap.io/ for email testing?

Also check this out for more help with sending mail with laravel
https://laravel.com/docs/5.4/mail#mail-and-local-development

@momame
Copy link
Author

momame commented Feb 15, 2017

well SMTP server is our default config in our project and in other module, mailing works fine, we don't want to use mailtrap in production. but mailtrap works in localhost like I mentioned before
what do you think?
Thanks

@tylercd100
Copy link
Owner

So, SMTP works just fine in production for your other emails? What version of Laravel are you using?

@momame
Copy link
Author

momame commented Feb 15, 2017

We are using the version 5.3.30

@tylercd100
Copy link
Owner

Hey Mo,

So I found some time to test it out on 5.3.30 and I am having no issues getting it to send an email using SMTP.

Can you try verifying your mail settings for production? config/mail.php

@momame
Copy link
Author

momame commented Feb 21, 2017

Still I have the problem

@momame
Copy link
Author

momame commented Feb 22, 2017

this is part of my code in handler.php

protected $dontReport = [
\Illuminate\Auth\AuthenticationException::class,
\Illuminate\Auth\Access\AuthorizationException::class,
\Symfony\Component\HttpKernel\Exception\HttpException::class,
\Illuminate\Database\Eloquent\ModelNotFoundException::class,
\Illuminate\Session\TokenMismatchException::class,
\Illuminate\Validation\ValidationException::class,
];

/**
 * Report or log an exception.
 *
 * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
 *
 * @param  \Exception  $exception
 * @return void
 */
public function report(Exception $e)
{
    if ($this->shouldReport($e)) {

        //Check to see if LERN is installed otherwise you will not get an exception.
        if (app()->bound("lern")) {
            app()->make("lern")->handle($e); //Record and Notify the Exception

            /*
            OR...
            app()->make("lern")->record($e); //Record the Exception to the database
            app()->make("lern")->notify($e); //Notify the Exception
            */
        }
    }
    //parent::report($e);
    return parent::report($e);
}

@momame
Copy link
Author

momame commented Feb 22, 2017

recently after some manipulation sometimes when Laravel throwing error it says undefined index to !

which seems has to with static function nativeMail in MonologHandlerFactory.php line 352. Therefore it means it wants to use nativeMail function but like I said our mailing is smtp

@momame
Copy link
Author

momame commented Feb 22, 2017

By the way our user/pass is null in production

MAIL_DRIVER=smtp
MAIL_HOST=xx.xx.xx.xx
MAIL_PORT=25
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=

@momame
Copy link
Author

momame commented Feb 23, 2017

It is fixed now our smtp configuration was not good. thanks anyway

@momame momame closed this as completed Feb 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants