Can you control emails via scripting?

Come up with a useful post-processing script? Share it here!
Post Reply
Vertigo1
Newbie
Newbie
Posts: 21
Joined: April 5th, 2009, 11:19 am

Can you control emails via scripting?

Post 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
User avatar
switch
Moderator
Moderator
Posts: 1380
Joined: January 17th, 2008, 3:55 pm
Location: UK

Re: Can you control emails via scripting?

Post 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.
Vertigo1
Newbie
Newbie
Posts: 21
Joined: April 5th, 2009, 11:19 am

Re: Can you control emails via scripting?

Post 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 :(
Vertigo1
Newbie
Newbie
Posts: 21
Joined: April 5th, 2009, 11:19 am

Re: Can you control emails via scripting?

Post by Vertigo1 »

Ok but how would I do that exactly?
User avatar
TeraLove
Newbie
Newbie
Posts: 18
Joined: June 1st, 2008, 9:07 pm

Re: Can you control emails via scripting?

Post 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.
Last edited by TeraLove on July 30th, 2009, 4:23 am, edited 1 time in total.
doubledrat
Release Testers
Release Testers
Posts: 180
Joined: February 20th, 2008, 3:16 pm

Re: Can you control emails via scripting?

Post by doubledrat »

this is very easy to do in a post processing script.  are you running unix or windows?
User avatar
TeraLove
Newbie
Newbie
Posts: 18
Joined: June 1st, 2008, 9:07 pm

Re: Can you control emails via scripting?

Post 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.
doubledrat
Release Testers
Release Testers
Posts: 180
Joined: February 20th, 2008, 3:16 pm

Re: Can you control emails via scripting?

Post 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
User avatar
TeraLove
Newbie
Newbie
Posts: 18
Joined: June 1st, 2008, 9:07 pm

Re: Can you control emails via scripting?

Post 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.
doubledrat
Release Testers
Release Testers
Posts: 180
Joined: February 20th, 2008, 3:16 pm

Re: Can you control emails via scripting?

Post by doubledrat »

it seems we're more interested in this than the original poster!
demioa
Newbie
Newbie
Posts: 18
Joined: March 29th, 2009, 8:08 pm

Re: Can you control emails via scripting?

Post 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.
Last edited by demioa on August 10th, 2009, 11:46 pm, edited 1 time in total.
User avatar
TeraLove
Newbie
Newbie
Posts: 18
Joined: June 1st, 2008, 9:07 pm

Re: Can you control emails via scripting?

Post 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.
demioa
Newbie
Newbie
Posts: 18
Joined: March 29th, 2009, 8:08 pm

Re: Can you control emails via scripting?

Post 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"
demioa
Newbie
Newbie
Posts: 18
Joined: March 29th, 2009, 8:08 pm

Re: Can you control emails via scripting?

Post 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.
Post Reply