Firmware: A-410 [01 Apr. 2014] | A-400 [12 Mar. 2014] | C-300 [13 Feb. 2014] | A-300 [24 Feb. 2014] | C-200 [11 July 2013] | A-200/A-210 [11 July 2013] | Popbox V8 [3 Dec 2013]

Just got your NMT | WIKI has the answers | Search the forum | Forum Rules/Policy | Firmware & Official NMT News | Popcornhour manuals



User(s) browsing this thread: 1 Guest(s)
Thread Closed 
NZBGet: sendmail when job is ready
04-07-2009, 05:13 PM (This post was last modified: 04-07-2009 05:14 PM by Donquix.)
Post: #31
RE: NZBGet: sendmail when job is ready
(04-07-2009 05:04 PM)RavenNL Wrote:  Ok tried that but getting a strange output now
Code:
# ./mail.sh
'leep: invalid number '1
'leep: invalid number '1
554 SMTP synchronization error


I just c/p your code in mail.sh and just be sure i chmod it again.
Code:
#mail.sh by donquix
(echo "HELO x"
sleep 1
echo "MAIL FROM: xxxx@telfort.nl"
sleep 1
echo "RCPT TO: xxxxx@telfort.nl"
sleep 1
echo "DATA"
sleep 1
echo "Subject: subject"
sleep 1
echo "From: Me <xxxx@telfort.nl>"
sleep 1
echo "To: You <xxxx@telfort.nl>"
sleep 1
echo ""
sleep 1
echo "email body"
sleep 1
echo "."
sleep 1
echo "QUIT")|nc smtp.telfort.nl 25

You have to replace all the sleep 1 commands with `sleep 1`:
Code:
#mail.sh by donquix
(`sleep 1`
echo "HELO x"
`sleep 1`
echo "MAIL FROM: xxxx@telfort.nl"
`sleep 1`
echo "RCPT TO: xxxxx@telfort.nl"
`sleep 1`
echo "DATA"
`sleep 1`
echo "Subject: subject"
`sleep 1`
echo "From: Me <xxxx@telfort.nl>"
`sleep 1`
echo "To: You <xxxx@telfort.nl>"
`sleep 1`
echo ""
`sleep 1`
echo "email body"
`sleep 1`
echo "."
`sleep 1`
echo "QUIT")|nc smtp.telfort.nl 25

Whatever you delete today, you desperately need tomorrow
Find all posts by this user
04-07-2009, 05:20 PM (This post was last modified: 04-07-2009 05:39 PM by RavenNL.)
Post: #32
RE: NZBGet: sendmail when job is ready
Tried it as well but now am getting this confused

Code:
# ./mail.sh
554 SMTP synchronization error
: not foundline 22:

(04-07-2009 05:20 PM)RavenNL Wrote:  Tried it as well but now am getting this confused

Code:
# ./mail.sh
554 SMTP synchronization error
: not foundline 22:

Sorry my bad I overlooked something

It works now, at least it's sending me a mailmessage.
But the output is looking strange

Code:
# ./mail.sh
220 ESMTP smtp-out3.tiscali.nl. NO UBE/UCE tolerated.
: not foundline 23:
250 smtp-out3.tiscali.nl Hello x [195.241.120.106]
: not foundline 23:
250 OK
: not foundline 23:
250 Accepted
: not foundline 23:
354 Enter message, ending with "." on a line by itself
: not foundline 23:
: not foundline 23:
: not foundline 23:
: not foundline 23:
: not foundline 23:
: not foundline 23:
250 OK id=1LrE95-0005on-C3
: not foundline 23:
221 smtp-out3.tiscali.nl closing connection


This is my mail.sh file
Code:
#mail.sh by donquix
(`sleep 1`
echo "HELO x"
`sleep 1`
echo "MAIL FROM: XXX@telfort.nl"
`sleep 1`
echo "RCPT TO: XXX@gmail.com"
`sleep 1`
echo "DATA"
`sleep 1`
echo "Subject: subject"
`sleep 1`
echo "From: Me <XXX@telfort.nl>"
`sleep 1`
echo "To: You <XXX@gmail.com>"
`sleep 1`
echo ""
`sleep 1`
echo "email body"
`sleep 1`
echo "."
`sleep 1`
echo "QUIT")|nc smtp.telfort.nl 25
Find all posts by this user
04-07-2009, 05:45 PM (This post was last modified: 04-07-2009 05:46 PM by Donquix.)
Post: #33
RE: NZBGet: sendmail when job is ready
(04-07-2009 05:20 PM)RavenNL Wrote:  But the output is looking strange

I get the same strange output but I've fixed it with this code:
Code:
#mail.sh by donquix
(`sleep 1` | echo "HELO x"
`sleep 1` | echo "MAIL FROM: popcorn@example.nl"
`sleep 1` | echo "RCPT TO: donquix@example.nl"
`sleep 1` | echo "DATA"
`sleep 1` | echo "From: Popcorn <popcorn@example.nl>"
`sleep 1` | echo "To: Donquix <donquix@example.nl>"
`sleep 1` | echo "Subject: test"
`sleep 1` | echo ""
`sleep 1` | echo "email body"
`sleep 1` | echo "."
`sleep 1` | echo "QUIT") | nc smtp.example.nl 25
It works like a charm

Whatever you delete today, you desperately need tomorrow
Find all posts by this user
[+] 1 user says Thank You to Donquix for this post
04-07-2009, 06:13 PM (This post was last modified: 04-07-2009 06:49 PM by RavenNL.)
Post: #34
RE: NZBGet: sendmail when job is ready
Tried it but not working how it should.

Code:
# ./mail.sh
554 SMTP synchronization error

I noticed when i do:
./mail.sh
554 SMTP synchronization error
and i press some keys on the keyboard it will eventually send the mail confused

Or it's just random luck that it sometimes will send a mail
I've changed the code to:
Code:
#mail.sh by donquix
(`sleep 1`
echo "HELO x"
`sleep 1` | echo "MAIL FROM: xxxx@telfort.nl"
`sleep 1` | echo "RCPT TO: xxxx@telfort.nl"
`sleep 1` | echo "DATA"
`sleep 1` | echo "From: HDX <xxxx@telfort.nl>"
`sleep 1` | echo "To: Donquix <xxxx@telfort.nl>"
`sleep 1` | echo "Subject: test"
`sleep 1` | echo ""
`sleep 1` | echo "email body"
`sleep 1` | echo "."
`sleep 1` | echo "QUIT") | nc smtp.telfort.nl 25

It works fine everytime I start it, but still get the following error message:
Code:
# ./mail.sh
220 ESMTP smtp-out2.tiscali.nl. NO UBE/UCE tolerated.
: not foundline 13:
250 smtp-out2.tiscali.nl Hello x [195.241.120.106]
250 OK
250 Accepted
354 Enter message, ending with "." on a line by itself
250 OK id=1LrFJu-0005UP-5s
221 smtp-out2.tiscali.nl closing connection

To be honest I can live with that message, it still does what it should be doing and that is sending that email Smile

But I'm wondering one thing, how am I gonna let him send an email automaticaly when a download is ready with this script?
Find all posts by this user
04-07-2009, 07:20 PM
Post: #35
RE: NZBGet: sendmail when job is ready
(04-07-2009 06:13 PM)RavenNL Wrote:  Tried it but not working how it should.

Code:
# ./mail.sh
554 SMTP synchronization error

I noticed when i do:
./mail.sh
554 SMTP synchronization error
and i press some keys on the keyboard it will eventually send the mail confused

Or it's just random luck that it sometimes will send a mail
I've changed the code to:
Code:
#mail.sh by donquix
(`sleep 1`
echo "HELO x"
`sleep 1` | echo "MAIL FROM: xxxx@telfort.nl"
`sleep 1` | echo "RCPT TO: xxxx@telfort.nl"
`sleep 1` | echo "DATA"
`sleep 1` | echo "From: HDX <xxxx@telfort.nl>"
`sleep 1` | echo "To: Donquix <xxxx@telfort.nl>"
`sleep 1` | echo "Subject: test"
`sleep 1` | echo ""
`sleep 1` | echo "email body"
`sleep 1` | echo "."
`sleep 1` | echo "QUIT") | nc smtp.telfort.nl 25

It works fine everytime I start it, but still get the following error message:
Code:
# ./mail.sh
220 ESMTP smtp-out2.tiscali.nl. NO UBE/UCE tolerated.
: not foundline 13:
250 smtp-out2.tiscali.nl Hello x [195.241.120.106]
250 OK
250 Accepted
354 Enter message, ending with "." on a line by itself
250 OK id=1LrFJu-0005UP-5s
221 smtp-out2.tiscali.nl closing connection

To be honest I can live with that message, it still does what it should be doing and that is sending that email Smile

But I'm wondering one thing, how am I gonna let him send an email automaticaly when a download is ready with this script?

I think that has to do with the first command, it's send without a delay. I can't get the delay to work without the weird errors.

Whatever you delete today, you desperately need tomorrow
Find all posts by this user
04-07-2009, 11:51 PM (This post was last modified: 04-08-2009 12:05 AM by Donquix.)
Post: #36
RE: NZBGet: sendmail when job is ready
(04-07-2009 06:13 PM)RavenNL Wrote:  But I'm wondering one thing, how am I gonna let him send an email automaticaly when a download is ready with this script?
If you replace the line echo "email body" with echo `cat filename` it prints out the contents of that file. When you put the script inside the unpack.sh at the place of the sendmail command (if you use the version of Rene123) and then replace filename to the log file it should work.
The only error you can get is that the nc command issn't found, the solution to that problem is to point the nc command to the busybox install: i.e. /share/.bin/nc.
This is what you get:
Code:
# -----------------------------------------------------------------------------------
# Send mail (added by Rene)
# -----------------------------------------------------------------------------------

   ShortDir=`expr substr "$1" 17 100`
   MailFile="$1"/../"$ShortDir".log

   echo "$ShortDir has been downloaded and unpacked to the HDX-1000" > "$MailFile"
   echo " "                         >> "$MailFile"
   echo "Download Dir" "$1"         >> "$MailFile"
   echo "NZB File    " "$2"         >> "$MailFile"
   echo "Par Check   " $4           >> "$MailFile"
   echo "NZB State   " $5           >> "$MailFile"
   echo "Par Fail    " $6           >> "$MailFile"
   echo " "                         >> "$MailFile"
   echo "----------------------------------------------------------------------" >> "$MailFile"
   echo " "      >> "$MailFile"
   du "$1"/* -ch >> "$MailFile"
   echo " "      >> "$MailFile"
   echo "----------------------------------------------------------------------" >> "$MailFile"
   echo " "      >> "$MailFile"
   ls "$1" -R1hl >> "$MailFile"
   echo " "      >> "$MailFile"
   echo "----------------------------------------------------------------------" >> "$MailFile"

#send mail via nc by Donquix

(`sleep 1`
echo "HELO x"
`sleep 1` | echo "MAIL FROM: xxxx@telfort.nl"
`sleep 1` | echo "RCPT TO: xxxx@telfort.nl"
`sleep 1` | echo "DATA"
`sleep 1` | echo "From: HDX <xxxx@telfort.nl>"
`sleep 1` | echo "To: Donquix <xxxx@telfort.nl>"
`sleep 1` | echo "Subject: Download ready: $ShortDir"
`sleep 1` | echo ""
`sleep 1` | echo `cat "$MailFile"`
`sleep 1` | echo "."
`sleep 1` | echo "QUIT") | /share/.bin/nc smtp.telfort.nl 25

rm "$MailFile"

Whatever you delete today, you desperately need tomorrow
Find all posts by this user
04-08-2009, 09:16 AM (This post was last modified: 04-08-2009 10:15 AM by RavenNL.)
Post: #37
RE: NZBGet: sendmail when job is ready
Good news the script is working now with the default unpack script, when the download is ready I get an email Big Grin

But I'm using lordy's unpack script since it automaticaly unpacks / delete rar & par files and auto move it to the desired directory like /share/video/Tv-Shows/Lost or /share/video/Tv-Shows/24 etc etc. That's the reason I want an email confirmation when the download is ready since everything is going automaticly I'm having problems to see which downloads are new Wink

I tried to insert the code into lordy's unpack script but somehow it doesn't sent an email. I'm also not sure if I put it in the right place. I tried to insert at the very end before the last fi but doesn't do anything.
Or I was thinking since the default unpack script can also delete all rar and par files after unpacking, would it be possible to add a code that it also automaticly moves the file to the correct directory. For instance 24 to /video/tv-shows/24 and lost to /video/tv-shows/lost. That is the only reason I'm using lordy's unpack script.

I checked out his code but I don't know where to start
Find all posts by this user
04-08-2009, 02:08 PM (This post was last modified: 04-08-2009 02:09 PM by Donquix.)
Post: #38
RE: NZBGet: sendmail when job is ready
I found these lines in lordy's unpack script:
Code:
...
1817.   if CHECK_TOP_LEVEL_UNRAR_STATE 1 ; then
1818.     INFO " ====== Post-process Finished : $1 : $NZB_NICE_NAME : $s $(date '+%T') ======"
1819.   else
1820.     ERROR " ====== Post-process Finished : $1 : $NZB_NICE_NAME : $s $(date '+%T') ======"
1821.   fi
...
When you put the code after line 1818 and after line 1820 it might just work. But it won't send you a logfile. To be sure you won't get an error remove the "cat" command from the mailscript. Also make sure you include "ShortDir=`expr substr "$1" 17 100`" before the mailscript otherwise you won't get the name of the download in your subject. Let me know if this works.

Whatever you delete today, you desperately need tomorrow
Find all posts by this user
04-08-2009, 02:49 PM (This post was last modified: 04-08-2009 03:31 PM by RavenNL.)
Post: #39
RE: NZBGet: sendmail when job is ready
Ok just done it and tried some test runs and guess what, it works Big Grin Big Grin Big Grin

I only added the script at line 1819 atm, but i have to c/p the same script at 1821 I presume?

How come the log file doesn't work anymore, just for my info. Don't mind seeing the subject only.
When i used the complete script

Code:
# -----------------------------------------------------------------------------------
# Send mail (added by Rene)
# -----------------------------------------------------------------------------------

   ShortDir=`expr substr "$1" 17 100`
   MailFile="$1"/../"$ShortDir".log

   echo "$ShortDir has been downloaded and unpacked to the HDX-1000" > "$MailFile"
   echo " "                         >> "$MailFile"
   echo "Download Dir" "$1"         >> "$MailFile"
   echo "NZB File    " "$2"         >> "$MailFile"
   echo "Par Check   " $4           >> "$MailFile"
   echo "NZB State   " $5           >> "$MailFile"
   echo "Par Fail    " $6           >> "$MailFile"
   echo " "                         >> "$MailFile"
   echo "----------------------------------------------------------------------" >> "$MailFile"
   echo " "      >> "$MailFile"
   du "$1"/* -ch >> "$MailFile"
   echo " "      >> "$MailFile"
   echo "----------------------------------------------------------------------" >> "$MailFile"
   echo " "      >> "$MailFile"
   ls "$1" -R1hl >> "$MailFile"
   echo " "      >> "$MailFile"
   echo "----------------------------------------------------------------------" >> "$MailFile"

#send mail via nc by Donquix

(`sleep 1`
echo "HELO x"
`sleep 1` | echo "MAIL FROM: XXX@telfort.nl"
`sleep 1` | echo "RCPT TO: XXX@gmail.com"
`sleep 1` | echo "DATA"
`sleep 1` | echo "From: HDX <XXX@telfort.nl>"
`sleep 1` | echo "To: Barry <XXX@gmail.com>"
`sleep 1` | echo "Subject: Download ready: $ShortDir"
`sleep 1` | echo ""
`sleep 1` | echo `cat unpak.log`
`sleep 1` | echo "."
`sleep 1` | echo "QUIT") | /share/.bin/nc smtp.telfort.nl 25

rm "$MailFile"

I received some error messages in nzbget, like:
Code:
[WARNING] unpak:15:06:20 /share/.nzbget/unpak.sh: line 75: cannot create /share/Download/southpark/../southpark.log: nonexistent directory
[WARNING] unpak:15:06:20 /share/.nzbget/unpak.sh: line 75: cannot create /share/Download/southpark/../southpark.log: nonexistent directory
[WARNING] unpak:15:06:20 /share/.nzbget/unpak.sh: line 75: cannot create /share/Download/southpark/../southpark.log: nonexistent directory
[WARNING] unpak:15:06:20 /share/.nzbget/unpak.sh: line 75: cannot create /share/Download/southpark/../southpark.log: nonexistent directory
[WARNING] unpak:15:06:20 /share/.nzbget/unpak.sh: line 75: cannot create /share/Download/southpark/../southpark.log: nonexistent directory
[WARNING] unpak:15:06:20 /share/.nzbget/unpak.sh: line 75: cannot create /share/Download/southpark/../southpark.log: nonexistent directory
[WARNING] unpak:15:06:20 /share/.nzbget/unpak.sh: line 75: cannot create /share/Download/southpark/../southpark.log: nonexistent directory
[WARNING] unpak:15:06:20 /share/.nzbget/unpak.sh: line 75: cannot create /share/Download/southpark/../southpark.log: nonexistent directory

So I removed the code from Rene and only left your code and inserted it in line 1819. Now I won't get that error message like above anymore and evertyhing is working fine. As you can see I changed the 'cat' command to 'cat unpak.log' since this script always makes a log file. Also that is working fine although it looks kind of messy with the formatting.
Find all posts by this user
04-08-2009, 03:41 PM
Post: #40
RE: NZBGet: sendmail when job is ready
I'm glad to hear it works! Who needs the lousy sendmail command?Cool

(04-08-2009 02:49 PM)RavenNL Wrote:  I only added the script at line 1819 atm, but i have to c/p the same script at 1821 I presume?

Line 1818 says info and line 1821 says error.. in some cases, were there is an error, you wont get an email. But since line 1818 and 1821 both give the same message I guess there won't be anything wrong. So to be 99.9% sure you get an email when a job is ready, just cp the script to both the lines.

Whatever you delete today, you desperately need tomorrow
Find all posts by this user
[+] 1 user says Thank You to Donquix for this post
04-08-2009, 03:46 PM
Post: #41
RE: NZBGet: sendmail when job is ready
(04-08-2009 03:41 PM)Donquix Wrote:  I'm glad to hear it works! Who needs the lousy sendmail command?Cool


Line 1818 says info and line 1821 says error.. in some cases, were there is an error, you wont get an email. But since line 1818 and 1821 both give the same message I guess there won't be anything wrong. So to be 99.9% sure you get an email when a job is ready, just cp the script to both the lines.

Still strange that the sendmail was giving problems, but who cares now Wink

A BIG THANKS for helping me all this way, I really appreciate it Big Grin Big GrinBig Grin
Find all posts by this user
04-08-2009, 04:08 PM
Post: #42
RE: NZBGet: sendmail when job is ready
(04-08-2009 03:46 PM)RavenNL Wrote:  Still strange that the sendmail was giving problems, but who cares now Wink

A BIG THANKS for helping me all this way, I really appreciate it Big Grin Big GrinBig Grin
You're welcome Smile

Whatever you delete today, you desperately need tomorrow
Find all posts by this user
04-13-2009, 08:34 AM (This post was last modified: 04-13-2009 08:37 AM by SukkaFoo.)
Post: #43
RE: NZBGet: sendmail when job is ready
Hi all;

When I run:

Code:
# nc smtp.webafrica.org.za 25

I get the following error:

Code:
/bin/sh: nc: not found

Anybody know what I might be doing incorrectly?
Find all posts by this user
04-13-2009, 09:30 AM
Post: #44
RE: NZBGet: sendmail when job is ready
Looks like your missing that command, have you tried reinstalling busybox from the csi installer?
Find all posts by this user
04-13-2009, 09:40 PM
Post: #45
RE: NZBGet: sendmail when job is ready
What version of Busybox are you running? I'm running version 1.5.0.
You can try replacing "nc" with "telnet". The only downside of this is (that I got) a lot of problems with the email body (when working out of a script) using telnet so I tried netcat which works just fine.

Whatever you delete today, you desperately need tomorrow
Find all posts by this user
Thread Closed 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  New Skin for NZBGet sparky3387 10 5,420 09-09-2012 08:32 PM
Last Post: astronyu
  NZBGET: Post-Process: /bin/sh: can't open ' ' Leceur 1 3,128 02-23-2010 04:38 PM
Last Post: Leceur
  ftp + windows7 = invisible .nzbget naitsirhc 4 3,086 02-09-2010 09:47 PM
Last Post: naitsirhc
  NZBget broken marty80 0 1,449 01-28-2010 03:03 PM
Last Post: marty80
  nzbget for a dumbass Deansocial 0 1,202 01-10-2010 10:54 PM
Last Post: Deansocial
  Remove nzbget Deansocial 13 5,709 01-01-2010 03:50 PM
Last Post: Deansocial
  NZBget Postprocessing koeletom 1 1,529 11-10-2009 09:13 AM
Last Post: hugbug
  Start nzbget in paused mode jorgb 2 1,682 10-04-2009 10:54 AM
Last Post: jorgb
  [A-110] NZBGet can't find nzbget.conf eBrain 1 2,422 10-01-2009 04:57 PM
Last Post: eBrain
Question Help. NZBGet download corrupted files can't remove Tjempeng 0 1,122 08-31-2009 05:52 PM
Last Post: Tjempeng

Forum Jump: