pman07 / Immich_Notify

2 stars 1 forks source link

Feature Request: Add Ability to Send Email for notification through ntfy #4

Closed feerlessleadr closed 11 months ago

feerlessleadr commented 11 months ago

Hey, I'm back but just wanted to let you know this has been rock solid for me. Thanks again.

I do have a bunch of users that I'd like to notify, but they are not technically inclined enough to install ntfy (or even know why that is).

I'd love to be able to add an option to also send an email in addition to the default ntfy message to a specific address, this way I can mass forward the email to those that would like to see new pictures.

I'm able to send emails in my own scripts following the directions in the attached: https://docs.ntfy.sh/publish/#e-mail-notifications

Thanks for your consideration!

pman07 commented 11 months ago

@feerlessleadr I'll see what I can do, glad you're enjoying the project!

pman07 commented 11 months ago

@feerlessleadr are you self hosting NTFY? If so, what are you using for your SMTP server?

feerlessleadr commented 11 months ago

@pman07 yeah I'm self hosting ntfy still. For my SMTP, I'm just using my email service's server (although I've also used Gmail's SMTP with ntfy and that works well also).

pman07 commented 11 months ago

@feerlessleadr Ok, I think what I have will work, I just don't have email notifications setup on my NTFY server.

I'm going to publish what I have for now, it doesn't cause any errors, but haven't been able to send an email yet.

If you're up for testing it feel free, otherwise I'm not sure when I'll get a chance to update my NTFY to use my gmail SMTP for full testing. Hopefully by the end of the week.

feerlessleadr commented 11 months ago

Sure thing, let me know when you push and what I need to set and I'm happy to test

pman07 commented 11 months ago

It's pushed. Just add the following to your stack.env with your desired notification email address

EMAIL=nobody@example.com
feerlessleadr commented 11 months ago

Testing now - will report back shortly

feerlessleadr commented 11 months ago

@pman07 happy to report it worked perfectly. Thank you!

Is it possible to either change the subject/body of the email to something like "Immich - XX photos added to (Album Name) album!", as well as add the immich icon?

I'm afraid my parents are going to see that email now that I'm thinking about it and ignore it because they aren't going to remember the emails related to their grandkids' pictures.

pman07 commented 11 months ago

@feerlessleadr cool! I don't believe it will accept the Immich icon, it only allows certain emojis. Would a customizable emoji in front of the subject such as "📷 Immich - XX photos added to (Album Name) album!" if you chose "emailTag = camera" work for you?

list of supported emojis/tags: https://docs.ntfy.sh/emojis/

feerlessleadr commented 11 months ago

That would be awesome, thanks!

pman07 commented 11 months ago

@feerlessleadr just pushed those changes. Just add a tag to the stack.env like follows.

EMAILTAG=camera
feerlessleadr commented 11 months ago

Thanks - this works great. The only bug I noticed is that I'm now getting 2 ntfy notifications, in addition to the email (so 3 notifications in total). I'm getting the original ntfy notification with the immich icon, along with another ntfy notification that is identical to the email notification.

pman07 commented 11 months ago

Ahhh, that makes sense.

I'm thinking a separate email topic would be cleanest, otherwise would have to have the same message and tags on both email and regular notification. Then as long as you don't subscribe to the email topic, you'll only get those via email.

Does this sound acceptable to you?

feerlessleadr commented 11 months ago

Yeah that works. I'm also ok with have an either/or option where it will send a ntfy notification OR email, depending on what the user selects in the env.

Then for those of us that want to send both, I can just spin up another instance of immich-notify with a separate stack.env.

I'm good with whatever you decide though honestly.

pman07 commented 11 months ago

@feerlessleadr ok it should work now. it will use whatever the topic is defined for each album with "_email" appended to it.

feerlessleadr commented 11 months ago

Testing now - just waiting for the script to run again

feerlessleadr commented 11 months ago

@pman07 worked perfectly thank you!

feerlessleadr commented 11 months ago

@pman07 Hey - just wanted to let you know this is still working great.

One thing one of my users asked for - is there a way to add a link to either the album directly? My parents are older and keep forgetting how to use the app, but if they had a link in the email right to the album, that would be awesom. Not sure that's possible though. Thanks

pman07 commented 11 months ago

It seems the title and body of the email have to be the same. I can add the link to the end of the message if you'd like?

feerlessleadr commented 11 months ago

Yeah, that works for me. Thanks!

pman07 commented 11 months ago

Ok, I just added the link to the email message. Please let me know if it works!

feerlessleadr commented 11 months ago

Absolutely perfect, thank you!