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


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.



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:


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:


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.



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:, it should show the response after sending the email.

If you don’t see anything try adding dd($emailError) here:

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:


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

    &lt;td class="content" style="border-collapse: collapse;"&gt;
        &lt;div style="font-size: 18px; margin: 42px 40px 42px; padding: 0;"&gt;


<p style=“color: #A7A6A6; font-size: 13px; line-height: 18px; margin: 0 0 7px; padding: 0;”>


&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>


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.

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: