snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
10.97k stars 3.16k forks source link

Having trouble setting up gmail #9057

Open aclegg-nefd opened 3 years ago

aclegg-nefd commented 3 years ago

Expected Behavior (or desired behavior if a feature request)

Preflight check for email is successfully sent


Actual Behavior

! mail could not be sent. Error: undefined

mailsettings


Please confirm you have done the following before posting your bug report:


Provide answers to these questions:

Please do not post an issue without answering the related questions above. If you have opened a different issue and already answered these questions, answer them again, once for every ticket. It will be next to impossible for us to help you.

https://snipe-it.readme.io/docs/getting-help

Thanks so much everyone! I apologize if anything is unclear, im happy to provide more info if necessary!

welcome[bot] commented 3 years ago

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

uberbrady commented 3 years ago

I'm not 100% sure, but I think you have to do some kind of "Generate legacy password" thing in Gmail to be able to send mail through it - you can't just use your regular Gmail password.

If you can set up a mail client (Thunderbird, Outlook Express, whatever) to send mail via SMTP using your Gmail credentials, then those settings should work when you put them into Snipe-IT.

It may also be that you have to 'enable IMAP' in your Gmail account? https://support.google.com/mail/answer/7126229?hl=en

Check Gmail through other email platforms - Gmail Help
Set up IMAP and change your SMTP settings to read Gmail messages in other mail clients, like Microsoft Outlook and Apple Mail. When you use IMAP, you can read your Gmail messages on multiple devices,
snipe commented 3 years ago

Also see the "Less Secure Apps" documentation: https://support.google.com/accounts/answer/6010255?hl=en

(I think that's in our Gmail documentation, but I don't recall.) https://snipe-it.readme.io/docs/configuration#using-gmail

Less secure apps & your Google Account - Google Account Help
If an app or site doesn’t meet our security standards, Google might block anyone who’s trying to sign in to your account from it. Less secure apps can make it easier for hackers to get in to your
Snipe-IT Documentation
Configuration
This section is where you edit the Snipe-IT configuration file to reflect your own settings, such as your database credentials, mail server, preferred language, timezone, and so on. Some of the settings are optional, some are required. Don't be intimidated by the length of this page. The configurat...
aclegg-nefd commented 3 years ago

Thanks for getting back to me @uberbrady ! I went ahead and enabled imap on my gmail account. I then cleared the cache using "php artisan config:clear" then restarted all WAMP services. Then i refreshed the preflight page and tried with my app password which was generated via google AND I tried the real password, neither of which worked. Any other thoughts?

EDIT: i did clear cache and restart services once i changed the password again.

Thank you!

aclegg-nefd commented 3 years ago

Thanks for getting back to me @snipe , i appreciate you sending these links along, but i did follow them both before opening this thread. Is there anything i can do to provide more info as to why emails arent being sent?

Thanks!

manwithpowers commented 3 years ago

I'm having this same issue on a new install (v5.0.12). I also tried switching to mail_driver=mail in my .env file

In laravel.log I see the following (happy to paste the whole thing if it would be helpful): [2021-01-27 22:32:54] production.ERROR: Class name must be a valid object or a string (View: .../resources/views/vendor/mail/html/message.blade.php) (View: .../resources/views/vendor/mail/html/message.blade.php) {"exception":"[object] (ErrorException(code: 0): Class name must be a valid object or a string (View: .../resources/views/vendor/mail/html/message.blade.php) (View: .../resources/views/vendor/mail/html/message.blade.php) at .../storage/framework/views/092b6ad17fceb12806355a85bd55ca7aeb212888.php:54) [stacktrace] ... [previous exception] [object] (ErrorException(code: 0): Class name must be a valid object or a string (View: .../resources/views/vendor/mail/html/message.blade.php) at .../storage/framework/views/092b6ad17fceb12806355a85bd55ca7aeb212888.php:54) [stacktrace] ... [previous exception] [object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Class name must be a valid object or a string at .../storage/framework/views/092b6ad17fceb12806355a85bd55ca7aeb212888.php:54)