SMTP E-Mail Sender IP Setting

Version ie <v5.11.73>

Environment

Checklist

  • Can you replicate the issue on our v5 demo site https://demo.invoiceninja.com or Invoice Ninja? > i cant test this on public website because my mail logininformation
  • Have you searched existing issues? > yes
  • Have you inspected the logs in storage/logs/laravel.log for any errors? > yes,

Describe the bug

i’m not sure if its bug. i send mails and the shown as SPAM Mails and the SPF is failed because the sender ip adress is not permit

Received-SPF: softfail ([google.com]: domain of transitioning [[email protected]] does not designate ipAdressOfMyOwnInternetWhereMyNASandDockerIsRunning as permitted sender) client-ip=ipAdressOfMyOwnInternetWhereMyNASandDockerIsRunning ;

and how i can signing (DKIM) the mails from invoiceninja ?

Steps To Reproduce

Settings > e-mail > test mail

Expected Behavior

email is sendung not over my docker system, send mail to mail server where i set up in settings.

Additional context

my its not a ninjainvoice problem, but where i can check if the mail is correct sending, any logs or settings i can make.

Screenshots

Logs

Hi,

Here’s what ChatGPT suggests in case it’s helpful:

You’re correct — the problem you’re experiencing is not directly an Invoice Ninja bug, but a mail configuration issue with how your Docker-hosted app is sending emails. Let’s go through how to properly configure your setup.


:red_exclamation_mark: Problem Breakdown

When you send an email from Invoice Ninja, your domain’s DNS records tell the recipient server whether the IP that sent the email is allowed to do so.

From your error:

Received-SPF: softfail (...) does not designate [your NAS IP] as permitted sender

This means:

  • Invoice Ninja is sending the mail directly from your NAS/Docker IP.
  • Your domain’s SPF record does not list your NAS’s IP as an allowed sender.
  • So, receiving servers flag it as suspicious → ends up in SPAM.

:white_check_mark: Solutions

Option 1: Use an external SMTP (recommended)

Make sure you configure Invoice Ninja to use your domain’s SMTP server so that email is sent through a permitted relay, not directly from your NAS.

Steps:

  1. Go to Settings > Email Settings in Invoice Ninja.

  2. Use these settings:

    • Driver: SMTP
    • Host: smtp.yourdomain.it (or Gmail/Outlook/Mailgun/etc.)
    • Port: 587 (or as required)
    • Encryption: tls
    • Username: [email protected]
    • Password: your email password or app password
    • From address: [email protected]
  3. Save and test the email again.

:white_check_mark: This way, the email is sent from your domain’s mail server — not directly from your NAS — and will pass SPF and DKIM checks (as long as your DNS is configured correctly).


Option 2: If you must send email directly from NAS (not recommended)

You’ll need to update your domain’s SPF record to include the IP of your NAS.

Example:

v=spf1 ip4:YOUR.NAS.IP.ADDRESS include:_spf.yourmailserver.com ~all

:warning: This is not ideal. ISPs don’t trust residential IPs for sending email.


:locked: DKIM Signing

DKIM is handled by the mail server, not by Invoice Ninja.

If you’re sending through your mail server (like via SMTP), your mail provider must support DKIM, and you must:

  • Enable DKIM in your domain’s DNS (your provider should give you the TXT record to add).
  • Make sure the SMTP server is signing messages (this usually happens automatically if set up properly).

:magnifying_glass_tilted_left: You can check DKIM using tools like:


:scroll: Logs to Check

In your Docker environment:

  • Check the Laravel logs in:

    storage/logs/laravel.log
    
  • Check your container logs:

    docker logs invoiceninja_container_name
    

These can show if the mail is being sent, and which driver is used.


:white_check_mark: Best Practice Summary

Setting Recommendation
Mail driver SMTP
SMTP server Your email provider (not sendmail/phpmail)
DKIM signing Handled by SMTP provider
SPF record Should allow SMTP provider’s IPs
Invoice Ninja mail logs storage/logs/laravel.log or Docker logs

Would you like help validating your current SPF/DKIM/DMARC setup with your domain? You can paste your domain name and I’ll check it for you.