Page 1 of 1
Can you control emails via scripting?
Posted: April 5th, 2009, 11:22 am
by Vertigo1
Got everything pretty much set up how I need with one exception. I need to send the job completion emails to different destinations depending on which of my user-defined categories the job was for.
Can I do this via scripting or any other means?
Thanks
Re: Can you control emails via scripting?
Posted: April 5th, 2009, 11:55 am
by switch
In 0.5 the email has been opened up to allow customisation, however I don't think the destination can be changed.
With it you could create an email filter from one central account that forwards the messages to other accounts however.
Re: Can you control emails via scripting?
Posted: April 5th, 2009, 2:00 pm
by Vertigo1
Thanks for the reply.
The content of the email is fine, I just need to control where it goes.
Basically I'm using the categories as a kind of user system. I have a subfolder under the NZB folder for each category (or user) so when they drop their NZB files in there they'll be tagged as that category and the resulting downloads will go into a specific folder for each user.
This works fine except I need to send the email to a different address for each user which I don't seem to be able to do
Re: Can you control emails via scripting?
Posted: April 5th, 2009, 3:51 pm
by Vertigo1
Ok but how would I do that exactly?
Re: Can you control emails via scripting?
Posted: July 30th, 2009, 2:38 am
by TeraLove
Vertigo1 wrote:
Got everything pretty much set up how I need with one exception. I need to send the job completion emails to different destinations depending on which of my user-defined categories the job was for.
Can I do this via scripting or any other means?
You can most definitely do this by scripting/programming. I'm assuming you're not a programmer, or you wouldn't be asking the question. Using an email filter is not necessary in this case.
If you use a script, try to have it be a platform-independent script, such as using Python, etc.
Re: Can you control emails via scripting?
Posted: July 30th, 2009, 4:03 am
by doubledrat
this is very easy to do in a post processing script. are you running unix or windows?
Re: Can you control emails via scripting?
Posted: July 30th, 2009, 4:21 am
by TeraLove
doubledrat wrote:
are you running unix or windows?
I'm not the original poster, but why should this matter? IMO, it would be better if the script is platform-independent. There are too many scripts on this forum that work on Windows or Linux, but not both, and this makes them somewhat undesirable.
Re: Can you control emails via scripting?
Posted: July 30th, 2009, 6:11 am
by doubledrat
true. it's just I know batch or shell scripting better than I know python. I could give him an answer in 2 mins in those environments, also I can't see many people wanting to do this, so portability may not be an issue
Re: Can you control emails via scripting?
Posted: July 30th, 2009, 1:16 pm
by TeraLove
doubledrat wrote:I could give him an answer in 2 mins in those environments
The nature of the data source mapping groups to emails is not defined. Part of the code is contingent upon it. In the simple case, I suppose one can assume it to be a CSV list.
Re: Can you control emails via scripting?
Posted: July 31st, 2009, 4:55 am
by doubledrat
it seems we're more interested in this than the original poster!
Re: Can you control emails via scripting?
Posted: August 10th, 2009, 11:38 pm
by demioa
I am also in need of such a script.
However my setup is a bit different.
I have a separate page for uploading NZBs that requires an e-mail address. The entered e-mail address is stored in a csv file. Is there anyway to look up and extract the email value from a CSV file?
this is very easy to do in a post processing script. are you running unix or windows?
I'll take the bash script.
Re: Can you control emails via scripting?
Posted: August 10th, 2009, 11:49 pm
by TeraLove
demioa wrote:I have a separate page for uploading NZBs that requires an e-mail address. The entered e-mail address is stored in a csv file. Is there anyway to look up and extract the email value from a CSV file?
A separate page? Do you mean that there is a separate web based interface that you use, where users can upload an NZB file and enter their email address at the same time? What exactly is this interface?
How is the email stored into a CSV file? Do you permanently store all email addresses in the CSV file? What else is stored in the CSV file? Details help - lots of them. It is of course possible to extract data from a CSV file. Perhaps you could attach a sample of the CSV file.
Re: Can you control emails via scripting?
Posted: August 12th, 2009, 7:47 am
by demioa
Well, the page is the web interface for my FTP. It is a private FTP I have for some friends over seas. If they upload an nzb file the ftp launches sabnzbd from a command line and starts to download the file. The FTP downloads the file to a new directory and makes an account for that file. Sabnzbd then emails my friend with the username (the folder name), password and separate url. With this setup my friends can request something when I am not home and use my connection to download it.
I am sure I have them upload the NZB to SABnzbd and download to their home folder in the FTP, but where is the challenge in that? :p
When the friend uploads the nzb, there is a form attached that asks for an email.
Here is the output of the csv in an html:
"Upload Forms Search" "{startDate=08/04/2009, showFormInfo=true, endDate=08/12/2009, showURLs=true, showPaths=true, export=true, uploadCount=100, reportName=UploadFormsSearch}" "Uploads" ,"Num","Count","Average Speed","Size","Name","Form Info","Local URL" ,"1","1","0 K/sec","5.44 Kb","/TV/selected_filesnzb","'sendemail:Yes', 'email:
[email protected]', ","file:/Volumes/TV/selected_files.nzb" ,"2","1","0 K/sec","1.15 Mb","/TV/something_else..nzb","'sendemail:No', 'email:none', ","file:/Volumes/Music/TV/something_else.nzb"
Re: Can you control emails via scripting?
Posted: August 12th, 2009, 10:48 am
by demioa
I took a look at the cheetah documentation and found that I may be able to simplify the process by having the emails stored in a template file. If I import that into the email.tmpl file and reference the person email that way, it will be much easier as there are only a hand full of users on my FTP.