Alt.Binz forum
Alt.Binz (English) => Help => Topic started by: yepadoos on November 12, 2010, 04:43:49 pm
-
I would like a script that I can execute after unrar that will send an email containing the name of the file that was unrar'd. I would like to use bmail for the email if possible. Does anyone have anything like this?
Thanks
-
The commandline options for bmail as listed here look pretty straightforward:
http://www.petri.co.il/send_mail_from_script.htm
Do you have Powershell or plain cmd.exe for Windows? With Powershell it's easiest to use inbuilt .NET functions with an smtp server, e.g.:
$from = "your@email.com"
$to = "some@other.com"
$subject = "Altbinz roxors"
$msg = "Whatever message you want"
$smtpServer = "localhost" # or whatever smtp server address
$smtp = New-Object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($from, $to, $subject, $msg)
-
I've gotten pretty close with this:
set body="%1 complete. Unrar Directory: %2"
c:
cd c:\program files\tversity\media server
mshare.exe -R
c:\bmail -s smtp.comcast.net -t 847XXXXXXX@vtext.com -f altbinz@protovision.net -h -b %1
I just cannot get it to concat the collection & unrar location into 1 string then email it.
This will send the collection name as an email/text message to my phone. If I could just concat the collection and unrar location together it would be perfect but my limited dos capabilities haven't been able to figure it out.
-
Well, once you set the 'body' variable, you need to reference it with %body%, so:
c:\bmail -s smtp.comcast.net -t 847XXXXXXX@vtext.com -f altbinz@protovision.net -h -b %body%
or
... -b "%body%"
whichever works.
-
This finally does what I want, it refreshes the tversity library and sends an email containing the collection and unrar location. The quotes around the variables was the major issue I was having. Thanks for your help.
set _string=%1
set _string2=%2
:: Remove quotes
SET _string=###%_string%###
SET _string=%_string:"###=%
SET _string=%_string:###"=%
SET _string=%_string:###=%
:: Remove quotes
SET _string2=###%_string2%###
SET _string2=%_string2:"###=%
SET _string2=%_string2:###"=%
SET _string2=%_string2:###=%
set body="%_string% complete. Unrar Directory: %_string2%"
echo.%body%
c:
cd c:\program files\tversity\media server
mshare.exe -R
c:\bmail -s smtp.comcast.net -t 8477103017@vtext.com -f altbinz@protovision.net -h -b %body%