Emailing an invoice takes a long time to return to the screen

Hi

Setup as self hosted, few niggles but getting there now. When I email an invoice, the app does send immediately, however the browser spinner continues for quite a long time (circa 5 mins) then returns me to the root folder of the site.

It’s setup on https://mydomain/ninja and seems to run ok. After an email is sent, after a long long wait, i’m returned to https://mydomain/ - if I then hit the back button, I get the email sent successfully message.

During this time (whilst it’s spinning), the client portal is not available either. It’s as if the app is trying to do something but locking out.

App was installed by Sofaculous (did not go smoothly), email is using localhost, no errors in the laravel-error.log - anything else I can check? It’s obviously a setup issue (permissions, redirects?) but no idea where to start.

Thanks

Simon

Hi Simon,

If you are using localhost for sending emails, you may be having an extended pause due to reverse lookups.

You may need to either disable require_rdns in sendmail config, or set your reverse DNS.

This is the first I’ve heard of this.

If you haven’t already it’s worth checking the web server error log.

Thanks both

I was using Sendmail so reverted to Mailgun and it now sends almost immediately.

Now i’ve found another issue, i’m trying to add another user Settings/User Management but when I hit Send Invitation, no emails are sent and nothing is in the logs.

Hopefully once that is sorted, I can use it in anger :slight_smile:

Simon

You may want to check your mail server logs to ensure it isn’t being sent.

Otherwise you can try adding dd(‘here’) here to check where it’s failing:

https://github.com/invoiceninja/invoiceninja/blob/master/app/Ninja/Mailers/UserMailer.php#L20

Thanks

Doesn’t make much sense what you mentioned though, adding dd(‘here’) just shows Here in the browser when I hit send invitation or am I missing something?

Mails are being sent from the rest of the application i.e. invoices etc, just not invitations. Surely it’s using the same mail functionality for this part as the invoice send?

Could you point me in the direction of the mail logs for Ninja please, struggling to find them atm.

Thanks

Simon

The same functionality is used throughout but the from address will be different for email for system emails, this may explain why it’s working for invoice emails but not user emails.

Our application doesn’t have an email log, you’d need to check your mail server log.

Where can I check what the from address is being set to for the new users?

I checked the code, it looks like the reply to is changed for system/user emails but the from address remains the same.

Can you try adding dd($response); here: https://github.com/invoiceninja/invoiceninja/blob/master/app/Ninja/Mailers/Mailer.php#L66, it should show the response after sending the email.

If you don’t see anything try adding dd($emailError) here: https://github.com/invoiceninja/invoiceninja/blob/master/app/Ninja/Mailers/Mailer.php#L110

ah haaa!!

“Unable to open file for reading [https://mydomain/ninja/public/images/invoiceninja-logo.png]”

I’ll try adding that file to see if it works :slight_smile:

Ahh ok logo is there but I cannot render it, however can render other images in that folder. What should the permissions be in there?

Right update. I’ve now got it working but there is clearly something wrong with permissions on this deployment. in the master_user.blade.php, i’ve had to remove all the image references, it now works.

My blade now looks like:

@extends(‘emails.master’)

@section(‘content’)
<tr>
<td bgcolor="#F4F5F5" style=“border-collapse: collapse;”> </td>
</tr>
<tr>
<td style=“border-collapse: collapse;”>
<table cellpadding=“10” cellspacing=“0” border=“0” bgcolor="#2F2C2B" width=“600” align=“center” class=“header”>
<tr>
<td class=“logo” style=“border-collapse: collapse; vertical-align: middle; padding-left:34px; padding-top:20px; padding-bottom:12px” valign=“middle”>

                &lt;/td&gt;
            &lt;/tr&gt;
        &lt;/table&gt;
    &lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
    &lt;td class="content" style="border-collapse: collapse;"&gt;
        &lt;div style="font-size: 18px; margin: 42px 40px 42px; padding: 0;"&gt;
            @yield('body')
        &lt;/div&gt;
    &lt;/td&gt;
&lt;/tr&gt;

@stop

@section(‘footer’)
<p style=“color: #A7A6A6; font-size: 13px; line-height: 18px; margin: 0 0 7px; padding: 0;”>

&lt;/p&gt;

&lt;p style="color: #A7A6A6; font-size: 13px; line-height: 18px; margin: 0 0 7px; padding: 0;"&gt;
    © {{ date('Y') }} Invoice Ninja&lt;br /&gt;
    <strong><a href="to('/settings/notifications') }}">{{ strtoupper(trans('texts.email_preferences')) }}</a></strong>
&lt;/p&gt;

@stop

Any suggestions how to fix this? I’ve also got major issues with cookies where I regularly get bounced to the root of the site, I then need to clear out cookies in order to use the app again. Completely random when this happens as well. Guessing Softaculous has not quite set the site up correctly, everything else appears to work properly though.

I think this should be fixed in our next release, here’s the fix if you want to patch the code.

https://github.com/invoiceninja/invoiceninja/commit/2b2cfbc2e501bf1f60db6b48dfe9a1726173c122

Not sure about the cookies, if you can figure out when it happens it may help track down the problem.

I’ve already got that fix applied but doesnt sort this issue out - only way was to remove the image references from the blade.

Cookies wise, i’ll open a new ticket, don’t want to fragment this one :slight_smile: