Send mail in groovy

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Send mail in groovy

andresgr
Hi!

Any easy way to send mail in groovy? or should i use javamail (it's
easy i know, but things in groovy tend to ben ultra-easy).

Cheers

--

-=-=-=-=-=-=-=-=-=-=-=-=-
Andrés González.

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: Send mail in groovy

Guillaume Laforge
Administrator
No special support for sending mail is provided by default by Groovy.

On 7/13/06, Andrés González <[hidden email]> wrote:

> Hi!
>
> Any easy way to send mail in groovy? or should i use javamail (it's
> easy i know, but things in groovy tend to ben ultra-easy).
>
> Cheers
>
> --
>
> -=-=-=-=-=-=-=-=-=-=-=-=-
> Andrés González.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>


--
Guillaume Laforge
Groovy Project Manager
http://glaforge.free.fr/blog/groovy

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: Send mail in groovy

Russel Winder
In reply to this post by andresgr
On Thu, 2006-07-13 at 17:33 +0200, Andrés González wrote:
> Hi!
>
> Any easy way to send mail in groovy? or should i use javamail (it's
> easy i know, but things in groovy tend to ben ultra-easy).

This was debated on the email list back in March this year and the
options seem to be:

        1.  Ant mail task using AntBuilder.
        2.  Apache Commons mail.
        3.  Java mail.
        4.  Spring Java mail.

Different people had different favourites.  In the end I plumped for the
Ant mail as it needs no extra jars than already required by Groovy and
it is very straighforward.

--
Russel.
====================================================
Dr Russel Winder                +44 20 7585 2200
41 Buckmaster Road              +44 7770 465 077
London SW11 1EN, UK             [hidden email]

signature.asc (198 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Send mail in groovy

graemer
See http://www.nabble.com/Net-utilities-questions-tf1261431.html#a3392830

Graeme

On 7/13/06, Russel Winder <[hidden email]> wrote:

> On Thu, 2006-07-13 at 17:33 +0200, Andrés González wrote:
> > Hi!
> >
> > Any easy way to send mail in groovy? or should i use javamail (it's
> > easy i know, but things in groovy tend to ben ultra-easy).
>
> This was debated on the email list back in March this year and the
> options seem to be:
>
>         1.  Ant mail task using AntBuilder.
>         2.  Apache Commons mail.
>         3.  Java mail.
>         4.  Spring Java mail.
>
> Different people had different favourites.  In the end I plumped for the
> Ant mail as it needs no extra jars than already required by Groovy and
> it is very straighforward.
>
> --
> Russel.
> ====================================================
> Dr Russel Winder                +44 20 7585 2200
> 41 Buckmaster Road              +44 7770 465 077
> London SW11 1EN, UK             [hidden email]
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (GNU/Linux)
>
> iD8DBQBEtmq7r2EGkixYSboRAnJ8AKCaAG6ofY8SwWafVF8xlIN/04bjyACgk0k5
> 3bnFUfDMwx66en+XEzuUACM=
> =g7Fc
> -----END PGP SIGNATURE-----
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: Send mail in groovy

andresgr
Thank you guys!

I think i'll go with the Ant Builder thing...

Long life to simplicity! :)

Cheers

On 7/13/06, Graeme Rocher <[hidden email]> wrote:

> See http://www.nabble.com/Net-utilities-questions-tf1261431.html#a3392830
>
> Graeme
>
> On 7/13/06, Russel Winder <[hidden email]> wrote:
> > On Thu, 2006-07-13 at 17:33 +0200, Andrés González wrote:
> > > Hi!
> > >
> > > Any easy way to send mail in groovy? or should i use javamail (it's
> > > easy i know, but things in groovy tend to ben ultra-easy).
> >
> > This was debated on the email list back in March this year and the
> > options seem to be:
> >
> >         1.  Ant mail task using AntBuilder.
> >         2.  Apache Commons mail.
> >         3.  Java mail.
> >         4.  Spring Java mail.
> >
> > Different people had different favourites.  In the end I plumped for the
> > Ant mail as it needs no extra jars than already required by Groovy and
> > it is very straighforward.
> >
> > --
> > Russel.
> > ====================================================
> > Dr Russel Winder                +44 20 7585 2200
> > 41 Buckmaster Road              +44 7770 465 077
> > London SW11 1EN, UK             [hidden email]
> >
> >
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.4.2.2 (GNU/Linux)
> >
> > iD8DBQBEtmq7r2EGkixYSboRAnJ8AKCaAG6ofY8SwWafVF8xlIN/04bjyACgk0k5
> > 3bnFUfDMwx66en+XEzuUACM=
> > =g7Fc
> > -----END PGP SIGNATURE-----
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>


--

-=-=-=-=-=-=-=-=-=-=-=-=-
Andrés González.

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: Send mail in groovy

David Budworth-3
I know this may not really help you if you are on windows (or need windows support), but we simply do:

def p = ["mail","-s","SUBJECT","TO@ADDR"].execute() //sends email with SUBJECT to TO@ADDR
p << EMAIL_BODY // actual email body
p.out.close() // close STDIN on mail so it doesn' thang
println p.text // prints output from sendmail (if any)

but this assumes you are on a unix box with a properly configured "mail" client.

3 lines of code (4 with debug output at end), no configuration needed, and no need for a live SMTP server being accessible.


On 7/13/06, Andrés González <[hidden email]> wrote:
Thank you guys!

I think i'll go with the Ant Builder thing...

Long life to simplicity! :)

Cheers

On 7/13/06, Graeme Rocher <[hidden email]> wrote:

> See http://www.nabble.com/Net-utilities-questions-tf1261431.html#a3392830
>
> Graeme
>
> On 7/13/06, Russel Winder < [hidden email]> wrote:
> > On Thu, 2006-07-13 at 17:33 +0200, Andrés González wrote:
> > > Hi!
> > >
> > > Any easy way to send mail in groovy? or should i use javamail (it's
> > > easy i know, but things in groovy tend to ben ultra-easy).
> >
> > This was debated on the email list back in March this year and the
> > options seem to be:
> >
> >         1.  Ant mail task using AntBuilder.
> >         2.  Apache Commons mail.
> >         3.  Java mail.
> >         4.  Spring Java mail.
> >
> > Different people had different favourites.  In the end I plumped for the
> > Ant mail as it needs no extra jars than already required by Groovy and
> > it is very straighforward.
> >
> > --
> > Russel.
> > ====================================================
> > Dr Russel Winder                +44 20 7585 2200
> > 41 Buckmaster Road              +44 7770 465 077
> > London SW11 1EN, UK             [hidden email]
> >
> >
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.4.2.2 (GNU/Linux)
> >
> > iD8DBQBEtmq7r2EGkixYSboRAnJ8AKCaAG6ofY8SwWafVF8xlIN/04bjyACgk0k5
> > 3bnFUfDMwx66en+XEzuUACM=
> > =g7Fc
> > -----END PGP SIGNATURE-----
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>


--

-=-=-=-=-=-=-=-=-=-=-=-=-
Andrés González.

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Send mail in groovy

andresgr
Yes, this is always a possibility, but i prefer the portability of the
other solutions... I mean,  I'll NO MORE be worry about sending email
in a script: i can install Java everywhere, can install groovy
everywhere and the AntBuilder thing allows me to send mail in four
lines.

That's close to perfect :)

Cheers

On 7/14/06, David Budworth <[hidden email]> wrote:

> I know this may not really help you if you are on windows (or need windows
> support), but we simply do:
>
> def p = ["mail","-s","SUBJECT","TO@ADDR"].execute() //sends email with
> SUBJECT to TO@ADDR
> p << EMAIL_BODY // actual email body
> p.out.close() // close STDIN on mail so it doesn' thang
> println p.text // prints output from sendmail (if any)
>
> but this assumes you are on a unix box with a properly configured "mail"
> client.
>
> 3 lines of code (4 with debug output at end), no configuration needed, and
> no need for a live SMTP server being accessible.
>
>
>
> On 7/13/06, Andrés González <[hidden email]> wrote:
> >
> Thank you guys!
>
> I think i'll go with the Ant Builder thing...
>
> Long life to simplicity! :)
>
> Cheers
>
> On 7/13/06, Graeme Rocher <[hidden email]> wrote:
> > See
> http://www.nabble.com/Net-utilities-questions-tf1261431.html#a3392830
> >
> > Graeme
> >
> > On 7/13/06, Russel Winder < [hidden email]> wrote:
> > > On Thu, 2006-07-13 at 17:33 +0200, Andrés González wrote:
> > > > Hi!
> > > >
> > > > Any easy way to send mail in groovy? or should i use javamail (it's
> > > > easy i know, but things in groovy tend to ben ultra-easy).
> > >
> > > This was debated on the email list back in March this year and the
> > > options seem to be:
> > >
> > >         1.  Ant mail task using AntBuilder.
> > >         2.  Apache Commons mail.
> > >         3.  Java mail.
> > >         4.  Spring Java mail.
> > >
> > > Different people had different favourites.  In the end I plumped for the
> > > Ant mail as it needs no extra jars than already required by Groovy and
> > > it is very straighforward.
> > >
> > > --
> > > Russel.
> > > ====================================================
> > > Dr Russel Winder                +44 20 7585 2200
> > > 41 Buckmaster Road              +44 7770 465 077
> > > London SW11 1EN, UK             [hidden email]
> > >
> > >
> > > -----BEGIN PGP SIGNATURE-----
> > > Version: GnuPG v1.4.2.2 (GNU/Linux)
> > >
> > >
> iD8DBQBEtmq7r2EGkixYSboRAnJ8AKCaAG6ofY8SwWafVF8xlIN/04bjyACgk0k5
> > > 3bnFUfDMwx66en+XEzuUACM=
> > > =g7Fc
> > > -----END PGP SIGNATURE-----
> > >
> > >
> > >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
> >
>
>
> --
>
> -=-=-=-=-=-=-=-=-=-=-=-=-
> Andrés González.
>
> ---------------------------------------------------------------------
>
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>


--

-=-=-=-=-=-=-=-=-=-=-=-=-
Andrés González.

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email