incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shane McEwan <sh...@actual-experience.com>
Subject Re: send mail with /bin/mail
Date Wed, 05 Dec 2012 14:30:38 GMT
On 05/12/12 14:17, Michael Bykov wrote:
> Hi,
>
> I am trying work with external process (i.e. sending a mail)
>
> [external]
> mail=/bin/bash /home/michael/web/socadimo/morpheus/lib/mail.sh
>
> [httpd_db_handlers]
> _mail = {couch_httpd_external, handle_external_req, <<"mail">>}
>
> mail.sh is:
>
> #!/bin/bash
> subject="$# parameters $1"
> email="m.bykov@gmail.com"
> echo "this is an email message test"> $message
> /bin/mail -s "$subject" "$email" < $message
>
> With curl "http://localhost:5984/diglossa/_mail?par=test"
>
> 1) I got message in Gmail, script works OK. But without parameters, i.e
> subject is "0 parameters".
> 2) In console log I got, nevertheless, an error:
>
> {"error":"{bad_return_value,{os_process_error,{exit_status,0}}}","reason":"{gen_server,call,\n,
> ... etc
>
>
> Please, advice me, is it correct approach? If so, how I can get the
> parameters in email?
>
>

This is a really bad idea. If you do get parameters to work with your 
current script then something like:

curl "http://localhost:5984/diglossa/_mail?test;rm -rf /var/lib/couchdb"

might delete your CouchDB database!

I suspect that's why parameters don't work. (I hope, anyway!)

Shane.


Mime
View raw message