Sending invoices via email is one of the most essential and time-saving features in Dolibarr ERP/CRM. However, many users encounter problems when trying to email documents like invoices or proposals. Most often, this issue is related to SMTP misconfigurations. If your invoices aren't being sent from Dolibarr, or you're getting vague error messages or no feedback at all, you're in the right place. This guide provides a thorough, step-by-step breakdown of common issues and practical solutions related to SMTP and email sending in Dolibarr.

Table of Contents

  1. Understanding How Email Sending Works in Dolibarr

  2. The Importance of SMTP Configuration

  3. Typical Signs That SMTP Is Misconfigured

  4. Common SMTP Error Messages in Dolibarr

  5. SMTP Prerequisites and Setup Overview

  6. Step-by-Step: Configuring SMTP in Dolibarr

  7. Testing the SMTP Setup

  8. Troubleshooting SMTP Failures

  9. Authentication and Security Protocols (TLS, SSL, STARTTLS)

  10. Using Gmail or Outlook with Dolibarr

  11. Email Quotas, Limits, and Reputation

  12. Logging and Debugging Tools

  13. Alternatives to SMTP in Dolibarr

  14. Maintaining a Reliable Email Setup

  15. Final Thoughts and Best Practices


1. Understanding How Email Sending Works in Dolibarr

Dolibarr can send emails using one of several methods:

  • PHP mail function (default, not reliable)

  • SMTP (recommended)

  • External email gateways via API or module

For professional and consistent delivery—especially when sending invoices—it’s best to configure SMTP.


2. The Importance of SMTP Configuration

SMTP (Simple Mail Transfer Protocol) is the standard for sending emails. It ensures secure, authenticated email delivery, reduces the chance of being marked as spam, and logs delivery issues.

If SMTP isn't configured or is set up incorrectly, Dolibarr may fail to send emails entirely or they may never reach their recipients.


3. Typical Signs That SMTP Is Misconfigured

  • You hit "Send Invoice" and nothing happens

  • You receive a vague error like “Error sending email”

  • No emails appear in the recipient’s inbox or spam folder

  • Dolibarr shows a timeout or connection refused message

These are all indications of SMTP configuration problems.


4. Common SMTP Error Messages in Dolibarr

Some SMTP-related error messages include:

  • "Connection timed out"

  • "Could not authenticate"

  • "SMTP: Invalid sender"

  • "Cannot connect to SMTP host"

  • "Email not accepted by server"

Each of these points to a different potential issue, from incorrect credentials to network-level restrictions.


5. SMTP Prerequisites and Setup Overview

Before configuring SMTP in Dolibarr, make sure you have:

  • A working email account (e.g., from Gmail, Outlook, or your domain provider)

  • SMTP host and port information

  • Username and password for the email account

  • Knowledge of which security protocol to use (SSL/TLS/STARTTLS)


6. Step-by-Step: Configuring SMTP in Dolibarr

  1. Log in as an admin.

  2. Navigate to Home > Setup > Email.

  3. Select the SMTP option.

  4. Enter your SMTP server information:

    • SMTP host (e.g., smtp.gmail.com)

    • SMTP port (587 for STARTTLS, 465 for SSL)

    • SMTP login (email address)

    • SMTP password

    • Security type (SSL, TLS, or STARTTLS)

  5. Save the settings.

Ensure that no extra spaces or invisible characters are present in the input fields.


7. Testing the SMTP Setup

After setting up SMTP:

  • Use the "Test email" button available in the email setup screen.

  • Send a test invoice to your own email.

  • Check the error logs if sending fails.

Also, verify that SPF, DKIM, and DMARC DNS records are correctly set for your sending domain to avoid spam filtering.


8. Troubleshooting SMTP Failures

If your test email fails:

  • Double-check your login and password

  • Try different SMTP ports (e.g., 465, 587, 25)

  • Switch between security protocols (STARTTLS vs SSL)

  • Ensure your server can make outbound SMTP connections (some hosting services block port 25)

  • Confirm that your domain isn’t blacklisted

You can test connection manually from the command line:

openssl s_client -connect smtp.gmail.com:465

This helps identify certificate or connectivity issues.


9. Authentication and Security Protocols (TLS, SSL, STARTTLS)

Some providers only support certain protocols:

  • Gmail uses STARTTLS on port 587

  • Outlook prefers SSL on port 465

  • Your own mail server might vary

Check with your provider’s documentation to get the right combination.

Misaligned protocol settings are one of the most common sources of SMTP failure in Dolibarr.


10. Using Gmail or Outlook with Dolibarr

Gmail:

  • Use app-specific password if 2FA is enabled

  • SMTP server: smtp.gmail.com

  • Port: 587

  • Protocol: STARTTLS

Outlook/Office365:

  • SMTP server: smtp.office365.com

  • Port: 587

  • Protocol: STARTTLS

  • May require modern authentication or application password

Note: Some free accounts may have email sending limits.


11. Email Quotas, Limits, and Reputation

Even with a correct setup, emails might not send due to:

  • Daily sending limits

  • IP reputation issues

  • Spam score too high (bad subject lines or missing headers)

Use reputable SMTP providers like SendGrid, Mailgun, or Amazon SES if you need reliability and scale.


12. Logging and Debugging Tools

Enable email logging in Dolibarr via the admin panel or in conf.php:

$dolibarr_main_prod = 0;

Review logs in:

  • /documents/dolibarr.log

  • Web server error log (/var/log/apache2/error.log)

These will often include the full SMTP error returned by the server.


13. Alternatives to SMTP in Dolibarr

If SMTP setup proves too complex, consider:

  • Using a module that integrates with an API-based provider (e.g., Sendinblue, Mailjet)

  • Relying on your hosting provider’s mail relay

  • Configuring an SMTP proxy or gateway for authentication

However, SMTP remains the most transparent and customizable method.


14. Maintaining a Reliable Email Setup

To keep your setup working:

  • Monitor email delivery regularly

  • Renew or rotate SMTP credentials periodically

  • Use SPF, DKIM, and DMARC to boost trustworthiness

  • Maintain updated contact info for bounce notifications

  • Avoid sending bulk emails from the same SMTP as invoices

These measures improve deliverability and ensure you’re notified when something goes wrong.


15. Final Thoughts and Best Practices

When invoices fail to send from Dolibarr, the issue almost always traces back to SMTP. A misconfigured server, wrong port or protocol, or outdated authentication method can block outgoing emails entirely.

Stick to these core principles:

  • Always test SMTP before going live

  • Use a secure, verified email provider

  • Monitor logs and delivery reports

  • Keep your configuration updated with your provider’s latest settings

By following this guide, you can turn Dolibarr into a reliable engine for professional invoice delivery and client communication.