[Solved] Fresh install fails to send email via SMTP (Gmail)

I am not able to email invoices on a fresh install of InvoicePlane. Configuration is as follows:

Email Sending Method: SMTP
SMTP Server Address: smtp.gmail.com
Requires Authentication: Yes
SMTP Username: user@domain-hosted-by-gmail.com
SMTP Password: ********
SMTP Port: 587
Security: TLS

When I try to send an invoice (making sure the sender address matches the SMTP Username), I get the following error:

Message body empty

A PHP Error was encountered

Severity: Warning
Message:  Cannot modify header information - headers already sent by (output started at 
/home/xxxx/public_html/dirname/invoice/application/modules/mailer/helpers/phpmailer/class.phpmailer.php:586)
Filename: libraries/Session.php
Line Number: 688

A PHP Error was encountered

Severity: Warning
Message:  Cannot modify header information - headers already sent by (output started at 
/home/xxxx/public_html/dirname/invoice/application/modules/mailer/helpers/phpmailer/class.phpmailer.php:586)
Filename: helpers/url_helper.php
Line Number: 542

Any ideas?

Please take a look at this issue that is related to yours: https://development.invoiceplane.com/browse/IP-77

Indeed, my host responded with the following:

All outgoing email on our shared hosting servers must be sent via
localhost, rather than using an external SMTP service. Please configure
your scripts to either use sendmail, or SMTP by connecting to localhost
on port 25.

Is this policy common enough to warrant mentioning in the Wiki or FAQ?

It will be added to the new wiki. :blush: