Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The sendMail {} method is not found in a controller #4

Open
veggie2u opened this issue Jun 10, 2013 · 3 comments
Open

The sendMail {} method is not found in a controller #4

veggie2u opened this issue Jun 10, 2013 · 3 comments

Comments

@veggie2u
Copy link

I have successfully sent an email from a controller with the sendGridService.sendMail {} method, and using the builder. (That works great, so thanks!) However, just calling sendMail {} from a controller method give me an error.

There is a no such method error for MyController.sendMail() is applicable for argument types MyController$_display_closure1. It appears that the sendMail method isn't registered in the controller, or is not expecting a closure?

@antony
Copy link
Collaborator

antony commented Jun 10, 2013

Hi there,

Hmm. The controller sendMail method was added for allowing easy porting
from the mail plugin to the sendgrid plugin, although I've never officially
supported it (I think sending mail from controllers is bad practice)

If you raise an issue I will take a look at getting this working again.

Cheers,
Antony
On 10 Jun 2013 04:42, "Chris Ward" notifications@github.com wrote:

I have successfully sent an email from a controller with the
sendGridService.sendMail {} method, and using the builder. (That works
great, so thanks!) However, just calling sendMail {} from a controller
method give me an error.

There is a no such method error for MyController.sendMail() is applicable
for argument types MyController$_display_closure1. It appears that the
sendMail method isn't registered in the controller, or is not expecting a
closure?


Reply to this email directly or view it on GitHubhttps://github.com//issues/4
.

@veggie2u
Copy link
Author

I would agree with you about sending email from controllers, but I was hoping that others did anyway. I am hoping to use a couple of plugins that send emails for things like signups, and password recovery and such. I was hoping that if the sendgrid sendMail method worked in the controllers, that the other plugins would use the controller method instead of the mailService service. Hmmm... I wonder... have you tried essentially aliasing the mailService service with your sendGridService by creating your service as a spring bean with the mailService name? I might have to try that... but I am a little green to grails still.

What would be nice actually would be an api that grails supports that sendMail or your plug in implement, so that any plugin wanting to send email would use that api and everything would just work :-)

@antony
Copy link
Collaborator

antony commented Jul 1, 2013

What would be nice actually would be an api that grails supports that sendMail or your plug in implement, so that any plugin wanting to send email would use that api and everything would just work :-)

Oddly enough Peter Ledbrook and I started working on this, and we got a basic structure working. Sadly, I don't have time to continue this work at the moment so I've had to leave it for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants