Send email on script

Send email on script

Postby Tumppi73 » Tue Aug 21, 2012 9:08 am

Hi

Perhaps a stupid question, but I could not find an answer. I would like to install a script on Transmission which sends an email when a torrent download is completed.

https://trac.transmissionbt.com/wiki/Scripts

Found the transmission settings.json and all, but I am not sure if the firmware comes with any sort of emailing function installed. If not, which and how should one install it.

Thanks!

ps. v12.1 installed, with Logitech MediaServer running. :punk
Tumppi73
 
Posts: 6
Joined: Thu Aug 16, 2012 11:51 am

Re: Send email on script

Postby fvdw » Tue Aug 21, 2012 11:31 am

no there is no e-mailing function installed in the firmware. On this moment I can not advise you on how to install such a function as its for me new land :dontknow . Sorry that I can't help you any better right now
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: Send email on script

Postby firwareslut » Tue Aug 21, 2012 11:40 am

If php sendmail module installed you can write a small php script and execute that.
firwareslut
Donator VIP
Donator VIP
 
Posts: 202
Joined: Thu Oct 06, 2011 11:53 am

Re: Send email on script

Postby fvdw » Tue Aug 21, 2012 6:22 pm

php sendmail needs the sendmail binary. This binary is present in the firmware I added it some time ago but nver found time to do something with it . However it is not located in /usr/sbin where php is looking for the binary, its actually in /bin but a simple symlink can solve that problem. For the rest the configuration files must be adapated. They are in /etc/mail
There is problem sendmail wants to have the /etc directory with 755 permission. However to avoid problems with the firmware we need 777 for the /etc folder. As result sendmail will refuse to run if you let it try create folders eand files in /etc/mail
In the config files you set another location for the files involved. I will do some test this evenings to see if I can get it to work
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: Send email on script

Postby Tumppi73 » Tue Aug 21, 2012 7:33 pm

Thanks!

As a return favour, I could do the Finnish translation of the UI. Let me know if that'd be helpful.
Tumppi73
 
Posts: 6
Joined: Thu Aug 16, 2012 11:51 am

Re: Send email on script

Postby Tumppi73 » Tue Aug 21, 2012 7:35 pm

and the PHP config and script I can easily play around with if the sendmail just works somehow.
Tumppi73
 
Posts: 6
Joined: Thu Aug 16, 2012 11:51 am

Re: Send email on script

Postby Tumppi73 » Wed Aug 22, 2012 9:28 am

Or. Plan B would be to enable SSL on PHP. Seems http://code.google.com/a/apache-extras.org/p/phpmailer/would be able to work directly with gmail if PHP supported SSL.

Now it just says

Code: Select all
SMTP -> ERROR: Failed to connect to server: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? (-70819889)
SMTP Error: Could not connect to SMTP host. Mailer Error: SMTP Error: Could not connect to SMTP host.
Tumppi73
 
Posts: 6
Joined: Thu Aug 16, 2012 11:51 am

Re: Send email on script

Postby fvdw » Wed Aug 22, 2012 12:37 pm

the sendmail binaries seems to work when adapting the config file to store the file it needs in another directory then /etc/mail
I used /mail (replaced all reference to /ect/mail by /mail) and creating local-host-names file in that directory
Also a directory /var/spool/mqueue had to be created (this directory will need to be created after each boot as the startup scripts clear the /var folder but that can be changed later
Also the sym link has to be place in /usr/sbin to sendmail in /bin

After a php test scrip to sent an e-mail run and sendmail tries to sent the e-mail. However for whatever reason it can not deliver the mail, the connection with the mailbox times out. This could be an issue with my internet provider not allowing to use other smtp servers. Seems that is a matter of setting up sendmail properly. On short notice I do not have the time to work on it.

About ssl support in php. The apache server in the firmware support it but indeed in php itself it seems not enabled right now. I tried to compile it as module but that failed. I guess a recompile of php is necessary to enable it. Need more time to look at that
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: Send email on script

Postby fvdw » Thu Aug 23, 2012 4:14 pm

I also compiled the latest version of sendmail 8.14.5 but that requires some safety measures as special users and groups to be created.
It seems the binary works ok but getting the configuration correct is the problem to be solved.
Its rather complicated when reading the howto's but there are still possibilities..to be continued as having an e-mail service is a nice feature.
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Re: Send email on script

Postby fvdw » Thu Aug 23, 2012 9:49 pm

seems the problem is not with sendmail.
For whatever reason the nwsp2 seems not be able to connect with smtp servers behind the router. Inside LAN it can connect to an smtp server but not to one on the internet.
its not a router issue I tried to contact the mail servers via my windows pc using telnet (in a command window) and was able to connect to them and send an e-mail. So the router is not the problem.
I tried also telnet on the nwsp2 and could connect to smtp servers in the LAN but not on the internet...
I can ping to the mail servers using the nwsp2 so it is able to go through the router and contact the server but it connot connect to port 25 or 587 (I tried also 465 and that worked partly on one server, the connection was established but i could not give commands. probably this is because port 465 is smtps and I need to use an ssl connection instead of telnet (plain text)
I used openssl client and was able to connect to that server abd sent an e-mail from the nwsp2.
So it seems to be finding the proper authentication method
Anyhow some progress is made..
fvdw
Site Admin - expert
 
Posts: 13471
Joined: Tue Apr 12, 2011 2:30 pm
Location: Netherlands

Next

Return to Development

Who is online

Users browsing this forum: No registered users and 10 guests