Problems with mail plugin

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

Problems with mail plugin

Pablo Pazos
hi, I've installed the mail plugin and follow the steps in teh tutorial but I can't get it working.

I follow the info on this page: http://grails.org/Mail+Plugin

I put this code in a controller but I get that it cant resolve MailService class:

import org.grails.mail.MailService

...

class MyController {

MailService mailService

....
def someAction = {

 mailService.sendMail {
   to "fred@g2one.com","ginger@g2one.com"
   from "john@g2one.com"
   cc "marge@g2one.com", "ed@g2one.com"
   bcc "joe@g2one.com"
   subject "Hello John"
   body 'this is some text'
 }
}
...
}


Any ideas?

thanks!!

Pablo Pazos Gutierrez
www.SimpleWebPortal.net
Reply | Threaded
Open this post in threaded view
|

Re: Problems with mail plugin

Graeme-Rocher
You don't need to import the MailService to use the sendMail method.
Controllers have the sendMail method injected to them, otherwise try
untyped injection

def mailService

Cheers

On Mon, Jun 9, 2008 at 7:23 PM, pablox <[hidden email]> wrote:

>
> hi, I've installed the mail plugin and follow the steps in teh tutorial but I
> can't get it working.
>
> I follow the info on this page: http://grails.org/Mail+Plugin
>
> I put this code in a controller but I get that it cant resolve MailService
> class:
>
> import org.grails.mail.MailService
>
> ...
>
> class MyController {
>
> MailService mailService
>
> ....
> def someAction = {
>
>  mailService.sendMail {
>   to "[hidden email]","[hidden email]"
>   from "[hidden email]"
>   cc "[hidden email]", "[hidden email]"
>   bcc "[hidden email]"
>   subject "Hello John"
>   body 'this is some text'
>  }
> }
> ...
> }
>
>
> Any ideas?
>
> thanks!!
>
> Pablo Pazos Gutierrez
> www.SimpleWebPortal.net
>
> --
> View this message in context: http://www.nabble.com/Problems-with-mail-plugin-tp17738805p17738805.html
> Sent from the grails - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>



--
Graeme Rocher
Grails Project Lead
G2One, Inc. Chief Technology Officer
http://www.g2one.com

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Problems with mail plugin

Pablo Pazos
thanks, I´ll try this.

now I get it work by moving the MailService into my app service package, do I need to move the service from the plugin to my app?


thanks!
Pablo.

On Mon, Jun 9, 2008 at 3:42 PM, Graeme Rocher <[hidden email]> wrote:
You don't need to import the MailService to use the sendMail method.
Controllers have the sendMail method injected to them, otherwise try
untyped injection

def mailService

Cheers

On Mon, Jun 9, 2008 at 7:23 PM, pablox <[hidden email]> wrote:
>
> hi, I've installed the mail plugin and follow the steps in teh tutorial but I
> can't get it working.
>
> I follow the info on this page: http://grails.org/Mail+Plugin
>
> I put this code in a controller but I get that it cant resolve MailService
> class:
>
> import org.grails.mail.MailService
>
> ...
>
> class MyController {
>
> MailService mailService
>
> ....
> def someAction = {
>
>  mailService.sendMail {
>   to "[hidden email]","[hidden email]"
>   from "[hidden email]"
>   cc "[hidden email]", "[hidden email]"
>   bcc "[hidden email]"
>   subject "Hello John"
>   body 'this is some text'
>  }
> }
> ...
> }
>
>
> Any ideas?
>
> thanks!!
>
> Pablo Pazos Gutierrez
> www.SimpleWebPortal.net
>
> --
> View this message in context: http://www.nabble.com/Problems-with-mail-plugin-tp17738805p17738805.html
> Sent from the grails - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>



--
Graeme Rocher
Grails Project Lead
G2One, Inc. Chief Technology Officer
http://www.g2one.com

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

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: Problems with mail plugin

Pablo Pazos
Yes! with def mailService it works.

now I have a question, what's the diference between doing def mailService and MailService mailService injection?

thanks.

On Mon, Jun 9, 2008 at 4:07 PM, Pablo Pazos <[hidden email]> wrote:
thanks, I´ll try this.

now I get it work by moving the MailService into my app service package, do I need to move the service from the plugin to my app?


thanks!
Pablo.


On Mon, Jun 9, 2008 at 3:42 PM, Graeme Rocher <[hidden email]> wrote:
You don't need to import the MailService to use the sendMail method.
Controllers have the sendMail method injected to them, otherwise try
untyped injection

def mailService

Cheers

On Mon, Jun 9, 2008 at 7:23 PM, pablox <[hidden email]> wrote:
>
> hi, I've installed the mail plugin and follow the steps in teh tutorial but I
> can't get it working.
>
> I follow the info on this page: http://grails.org/Mail+Plugin
>
> I put this code in a controller but I get that it cant resolve MailService
> class:
>
> import org.grails.mail.MailService
>
> ...
>
> class MyController {
>
> MailService mailService
>
> ....
> def someAction = {
>
>  mailService.sendMail {
>   to "[hidden email]","[hidden email]"
>   from "[hidden email]"
>   cc "[hidden email]", "[hidden email]"
>   bcc "[hidden email]"
>   subject "Hello John"
>   body 'this is some text'
>  }
> }
> ...
> }
>
>
> Any ideas?
>
> thanks!!
>
> Pablo Pazos Gutierrez
> www.SimpleWebPortal.net
>
> --
> View this message in context: http://www.nabble.com/Problems-with-mail-plugin-tp17738805p17738805.html
> Sent from the grails - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>



--
Graeme Rocher
Grails Project Lead
G2One, Inc. Chief Technology Officer
http://www.g2one.com

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

   http://xircles.codehaus.org/manage_email




Reply | Threaded
Open this post in threaded view
|

Re: Problems with mail plugin

Pablo Pazos
In reply to this post by Graeme-Rocher
Hi Graeme, I have another problem.

I need to call sendMail from another service (I got a notification service that sends notifications by email).
So, I've injected the mails service and called sendMail just the same way I do it on the controller but I get this:

Message: No signature of method: java.lang.String.call() is applicable for argument types: (java.lang.String) values: {"pazospablo@hotmail.com"}
Caused by: groovy.lang.MissingMethodException: No signature of method: java.lang.String.call() is applicable for argument types: (java.lang.String) values: {"pazospablo@hotmail.com"}
Class: NotificationService

My code:

class NotificationService {
   
    def mailService // Para mandar emails
...
    public sendEmailNotification ( Locale locale, Notification content, String email )
    {
        def from    = i18nService.getInternationalizableMessage(content.from, locale)
        def subject = i18nService.getInternationalizableMessage(content.subject, locale)
        def body    = i18nService.getInternationalizableMessage(content.body, locale)

            mailService.sendMail {    
               to "pablo.swp@gmail.com"
               from "pazospablo@hotmail.com"
               subject "jojojo"    
               body 'Que haces loco?'
            }
    }
...
}


thanks!


Pablo Pazos Gutierrez
www.SimpleWebPortal.net




Graeme Rocher-2 wrote
You don't need to import the MailService to use the sendMail method.
Controllers have the sendMail method injected to them, otherwise try
untyped injection

def mailService

Cheers

On Mon, Jun 9, 2008 at 7:23 PM, pablox <pablo@mirigi.com> wrote:
>
> hi, I've installed the mail plugin and follow the steps in teh tutorial but I
> can't get it working.
>
> I follow the info on this page: http://grails.org/Mail+Plugin
>
> I put this code in a controller but I get that it cant resolve MailService
> class:
>
> import org.grails.mail.MailService
>
> ...
>
> class MyController {
>
> MailService mailService
>
> ....
> def someAction = {
>
>  mailService.sendMail {
>   to "fred@g2one.com","ginger@g2one.com"
>   from "john@g2one.com"
>   cc "marge@g2one.com", "ed@g2one.com"
>   bcc "joe@g2one.com"
>   subject "Hello John"
>   body 'this is some text'
>  }
> }
> ...
> }
>
>
> Any ideas?
>
> thanks!!
>
> Pablo Pazos Gutierrez
> www.SimpleWebPortal.net
>
> --
> View this message in context: http://www.nabble.com/Problems-with-mail-plugin-tp17738805p17738805.html
> Sent from the grails - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>



--
Graeme Rocher
Grails Project Lead
G2One, Inc. Chief Technology Officer
http://www.g2one.com

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

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: Problems with mail plugin

Graeme-Rocher
Your local variables like "from" are conflicting with the method names
"from" rename your local ones

Cheers

On Mon, Jun 9, 2008 at 10:16 PM, pablox <[hidden email]> wrote:

>
> Hi Graeme, I have another problem.
>
> I need to call sendMail from another service (I got a notification service
> that sends notifications by email).
> So, I've injected the mails service and called sendMail just the same way I
> do it on the controller but I get this:
>
> Message: No signature of method: java.lang.String.call() is applicable for
> argument types: (java.lang.String) values: {"[hidden email]"}
> Caused by: groovy.lang.MissingMethodException: No signature of method:
> java.lang.String.call() is applicable for argument types: (java.lang.String)
> values: {"[hidden email]"}
> Class: NotificationService
>
> My code:
>
> class NotificationService {
>
>    def mailService // Para mandar emails
> ...
>    public sendEmailNotification ( Locale locale, Notification content,
> String email )
>    {
>        def from    =
> i18nService.getInternationalizableMessage(content.from, locale)
>        def subject =
> i18nService.getInternationalizableMessage(content.subject, locale)
>        def body    =
> i18nService.getInternationalizableMessage(content.body, locale)
>
>            mailService.sendMail {
>               to "[hidden email]"
>               from "[hidden email]"
>               subject "jojojo"
>               body 'Que haces loco?'
>            }
>    }
> ...
> }
>
>
> thanks!
>
>
> Pablo Pazos Gutierrez
> www.SimpleWebPortal.net
>
>
>
>
>
> Graeme Rocher-2 wrote:
>>
>> You don't need to import the MailService to use the sendMail method.
>> Controllers have the sendMail method injected to them, otherwise try
>> untyped injection
>>
>> def mailService
>>
>> Cheers
>>
>> On Mon, Jun 9, 2008 at 7:23 PM, pablox <[hidden email]> wrote:
>>>
>>> hi, I've installed the mail plugin and follow the steps in teh tutorial
>>> but I
>>> can't get it working.
>>>
>>> I follow the info on this page: http://grails.org/Mail+Plugin
>>>
>>> I put this code in a controller but I get that it cant resolve
>>> MailService
>>> class:
>>>
>>> import org.grails.mail.MailService
>>>
>>> ...
>>>
>>> class MyController {
>>>
>>> MailService mailService
>>>
>>> ....
>>> def someAction = {
>>>
>>>  mailService.sendMail {
>>>   to "[hidden email]","[hidden email]"
>>>   from "[hidden email]"
>>>   cc "[hidden email]", "[hidden email]"
>>>   bcc "[hidden email]"
>>>   subject "Hello John"
>>>   body 'this is some text'
>>>  }
>>> }
>>> ...
>>> }
>>>
>>>
>>> Any ideas?
>>>
>>> thanks!!
>>>
>>> Pablo Pazos Gutierrez
>>> www.SimpleWebPortal.net
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Problems-with-mail-plugin-tp17738805p17738805.html
>>> Sent from the grails - user mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>    http://xircles.codehaus.org/manage_email
>>>
>>>
>>>
>>
>>
>>
>> --
>> Graeme Rocher
>> Grails Project Lead
>> G2One, Inc. Chief Technology Officer
>> http://www.g2one.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Problems-with-mail-plugin-tp17738805p17742276.html
> Sent from the grails - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>



--
Graeme Rocher
Grails Project Lead
G2One, Inc. Chief Technology Officer
http://www.g2one.com

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

    http://xircles.codehaus.org/manage_email