[Pljava-dev] emailing with pl/java

Lucas Madar lucas at mcsnw.com
Mon May 5 18:01:33 UTC 2008


Roberts, Jon wrote:
> CREATE OR REPLACE FUNCTION control.fn_smtp(p_smtp_server varchar, p_to
> varchar, p_from varchar, p_subject varchar, p_body varchar) returns
> varchar as
> 'smtp.send(java.lang.String, java.lang.String, java.lang.String,
> java.lang.String, java.lang.String)'
>   LANGUAGE 'java';
>
> It returns: "ERROR: IOException while sending message"
>
> What gives?  Why doesn't this work in pl/java but works just fine from
> the command line?
>   
I believe the security of the 'java' language is probably getting in 
your way. It doesn't allow you to open files, so it probably doesn't 
allow you to open socket connections, either. Try using the 'javau' 
language, which has no security checks:

e.g. CREATE OR REPLACE FUNCTION control.fn_smtp ... LANGUAGE 'javau';

Good luck,
Lucas



More information about the Pljava-dev mailing list