How to test send email

Hi,

I decided to change my .env from MAIL_MAILER=log to smtp.
All other variables are filled.

How can I check if it works, is there a test email function somewhere?

Thanks.

Hi,

I think you’d need to try sending a test invoice.

Hi,

Is there a log file that I can check when emails are not sent ?

https://invoiceninja.github.io/docs/self-host-troubleshooting/#email-not-sending

I’m having similar issues with getting e-mail config correct. Using v5.1.61-C47 installed via softalicious (which seems to just not put any e-mail settings in and just default to log instead of setting SMTP correctly !)

This is what I’ve set my .env settings [clearly I’ve changed actual details to “invoice.mydomain” and the password so as not to post them in the clear here]

MAIL_MAILER=smtp
MAIL_HOST=invoice.mydomain
MAIL_PORT=465
MAIL_USERNAME=‘mailer@invoice.mydomain’
MAIL_PASSWORD=MySecretPassword
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=‘mail@mydomain’
MAIL_FROM_NAME=‘Ian Invoiceninja’

This is what cpanel has to say about the setting for the account I created to deal with outgoing e-mail

so as far as I can see I’ve got them set up correctly.

The Laveral log seems OK

[2021-05-16 20:45:30] production.INFO: Importing account
[2021-05-16 20:45:30] production.INFO: Importing company
[2021-05-16 20:45:30] production.INFO: the path https://invoice.mydomain//storage/lwzzjolibqgwmijedum3kh79ebcb0qgl/jmzkrS3HJTH6ezgnyePI5hEgiWXucEkhDUOB8biW.png
[2021-05-16 20:45:30] production.INFO: Importing users
[2021-05-16 20:45:30] production.INFO: Importing payment_terms
[2021-05-16 20:45:30] production.INFO: Importing tax_rates
[2021-05-16 20:45:30] production.INFO: Importing clients
[2021-05-16 20:45:30] production.INFO: Importing company_gateways
[2021-05-16 20:45:30] production.INFO: Importing client_gateway_tokens
[2021-05-16 20:45:30] production.INFO: Importing vendors
[2021-05-16 20:45:30] production.INFO: Importing projects
[2021-05-16 20:45:30] production.INFO: Importing products
[2021-05-16 20:45:30] production.INFO: Importing credits
[2021-05-16 20:45:30] production.INFO: Importing invoices
[2021-05-16 20:45:31] production.INFO: Importing recurring_invoices
[2021-05-16 20:45:31] production.INFO: Importing quotes
[2021-05-16 20:45:31] production.INFO: Importing payments
[2021-05-16 20:45:32] production.INFO: Importing expense_categories
[2021-05-16 20:45:32] production.INFO: Importing task_statuses
[2021-05-16 20:45:32] production.INFO: in task statuses
[2021-05-16 20:45:32] production.INFO: finished task statuses
[2021-05-16 20:45:32] production.INFO: Importing expenses
[2021-05-16 20:45:32] production.INFO: Importing tasks
[2021-05-16 20:45:32] production.INFO: Importing documents
[2021-05-16 20:46:07] production.INFO: latest version = 5.1.62
[2021-05-16 20:46:07] production.INFO: Completed🚀🚀🚀🚀🚀 at 2021-05-16 20:46:07
[2021-05-16 21:00:03] production.INFO: latest version = 5.1.62

But no migration notification e-mail has been sent.

System Log is empty.

I can login with main account created at install, but I cannot connect with other user accounts from the migration, not can I use the Recover password feature as I get

TimeoutException after 0:00:30.000000: Future not completed

Which I assume is due to incorrectly configured e-mail settings. Is there a way I can test the settings since as far as I can tell they are correct and I’ve followed all the advice on the self-host trouble shooting, and not found anything useful.

Does anyone have any pointers?

If you’re login, you should get an email about this.

port 465 is for SSL right? 587 is for TLS?

1 Like

Tried changing to SSL from TLS in .env file same error. could this be related to fact that shared hosting admins have without comment or message to me reduced cron to */15 from * minutes?I’m presuming this is a “I can’t connect to the e-mail after 30 secs” time out

@n03lm

The crons don’t send out the emails, they are sent immediately.

You may see more information in the activity tab on the dashboard if there is a specific error being returned.

Nothing in System activity other than the migration events. no errors in laveral.log proving a challenge to find much more than the error above to then work out why not working …

Thus my posting on the how do I test my e-mail settings thread.

ohh this might let me test laveral

EDIT - in shared hosting you need to do this https://laracasts.com/discuss/channels/servers/tinker-doset-work-in-shared-hosting

EDIT 2 OK that test works for e-mail. and I get a correctly framed message, that has been authorised by the SMTP user in .env and send from the email and name in .env so I know e-mail via laveral is working. and if I open up the website in a new private browsing window I don’t get any error and it send me a e-mail to reset the user password. Note ALWAYS worth testing in private browsing window incase something in browser cache in messing with you !

Big thanks for @david for reminding me about default ports for SSL vs TLS.

1 Like

Can´t you guys consider to add a test mail function in Settings → email options or something like that?
It would be way easier.
Kind regards

Final point clear the cache , php tinker config:cache

regards,