Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9017657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:19:41+00:00 2026-06-16T04:19:41+00:00

I added to Config.groovy default mail body by adding this line: grails.mail.default.body = Test

  • 0

I added to Config.groovy default mail body by adding this line:

 grails.mail.default.body = "Test body"

and then I am passing adress, subject and body from form by params in a sendMail method:

sendMail {
    to params.adress
    subject params.title
    body params.body
}

It works fine if params.body is not empty, but when user ignores this field the default body is not added to mail – the mail cant be sent without body.

Class
grails.plugin.mail.GrailsMailException
Message
message has no content, use text(), html() or body() methods to set content

What mistake I did here? Is there some special way I need to handle default content of mail body, subject or other fields?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T04:19:42+00:00Added an answer on June 16, 2026 at 4:19 am

    The mail plugin has special support for default.to and default.from but not default.body (or subject, or anything else). You could handle it yourself:

    sendMail {
        to params.adress
        subject params.title
        body(params.body ?: grailsApplication.config.grails.mail.default.body)
    }
    

    but the plugin won’t do it for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have added this rule in my web.config to redirect non www URLs to
I followed the instruction here: http://www.grails.org/doc/latest/guide/7.%20Validation.html and added into config.groovy : grails.validateable.classes = [liningtest.Warm']
I've added the following parameter in Config.groovy storeFront.cms.endpoint = http://10.60.33.51:27110/file_source I'm trying to read
I'm breaking my grails application into modules by using plugins and then adding the
I created WCF RIA services. It added app.config by default. But there is no
I've added an onAuthenticationSuccessEvent to my config.groovy in order to try add a Login
I've added # config/initializers/will_paginate_array_fix.rb require 'will_paginate/array' but still do not seem to be getting
I made changes to my Vagrantfile (added config.vm.share_folder , config.vm.customize lines) and now I
i've added code config.gem authlogic-oauth, :lib => authlogic_oauth to the environment.rb file in my
I have added options in application.rb: config.autoload_paths += %W(#{config.root}/lib) config.autoload_paths += Dir[#{config.root}/lib/**/] and lib\functions.rb:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.