March 10, 20206 yr Hi all, I've been trying to get a script working to manage backups and send an email with attachment at the end. I'm using mailgun as my email sender, and have configured the Notification settings for it in GUI. After much googling and reading, I see that there are 2 (Kind of 3) methods: - use ssmtp eg (Which invokes sendmail): ssmtp [email protected] < /mnt/user/ftp/test_attachment.txt - use sendmail directly eg: ssmtp [email protected] < /mnt/user/ftp/test_attachment.txt - use the recommended notify (without email): /usr/local/emhttp/webGui/scripts/notify -i warning -s "my subject" -d "some description" I am also trying to get email subsystem of notify to work, without success: /usr/local/emhttp/webGui/scripts/notify smtp-init -i normal -s "Subject" -d "Something" -m "Message" Email notifications in the unRAID GUI work when I send a test mail there. I receive the mail in my gmail. The problem is that: - I cant get Notify to send any email at all, I need an example if possible. - I cant get ssmtp/sendmail to work, as it sends email as root, and does not work, just like in this old thread. I've tried configuring the revaliases, but I understand this should be avoided. Does anyone know the proper way to send an email using CLI, and would be able to provide an example? Thanks for any help. Edit: When I use sendmail/ssmtp, I get this response basically every time: [<-] 220 ak47 ESMTP ready [->] EHLO blaster [<-] 250 SMTPUTF8 [->] AUTH LOGIN [<-] 334 VXNlcm5hbWU6 [->] Ymxhc3RlckBzdHJha2VyLm1l [<-] 334 UGFzc3dvcmQ6 [<-] 235 2.0.0 OK [->] MAIL FROM:<root@my.domain> [<-] 250 Sender address accepted [->] RCPT TO:<target_email@gmail.com> [<-] 250 Recipient address accepted [->] DATA [<-] 354 Continue [->] Received: by blaster (sSMTP sendmail emulation); Wed, 11 Mar 2020 01:00:14 +0100 [->] From: "Console and webGui login account" <root@my.domain> [->] Date: Wed, 11 Mar 2020 01:00:14 +0100 [->] [->] . [<-] 250 Great success [->] QUIT [<-] 221 See you later. Yours truly, Mailgun The email sends as `[email protected]` and has no anything, but goes to my spam as an empty email with sender `Console and webGui login account <[email protected]>`. Help, anyone? Edited March 11, 20206 yr by KptnKMan
March 12, 20206 yr On 3/10/2020 at 7:56 PM, KptnKMan said: I am also trying to get email subsystem of notify to work, without success: If you don't have under notification settings for it to send an email for Warnings, then you won't get the email.
March 12, 20206 yr Author Thanks @Squid I'm looking for a way to send only emails, especially with attachments of script logs etc. I use Pushbullet for my notifications, and I was hoping I could invoke email as a separate thing, as that would be ideal. Do you know if its possible to setup a config for using ssmtp/sendmail? It seems to half work.
April 15, 20206 yr I've had some issues with Notify too. I used to send it through my ISP - but it proved far less reliable than using gmail (after turning on 'allow 3rd party apps'). I too was able to use 'test' in the GUI and it worked every time. But scripted, not so good (when using the ISP). Sometimes it didn't work, sometimes it took hours. Do you get any errors when you run it? Here's one of mine that works - when i run it as root. Are you running yours as root from the terminal? /usr/local/emhttp/webGui/scripts/notify -e "$(date +"%Y-%m-%d %H:%M")" -s "borg-check >> SUCCESS <<" -d "$BORG_REPO :: Finished successfully ::" -m "Logs :: $LOGFILE" -i "normal" I came here hoping someone out there has successfully run notify without root - i'm 99% sure it used to work but not with 6.8.2 at least.
Archived
This topic is now archived and is closed to further replies.