email - Use e-mail confirmation in grails -
i want use email confirmation user after creating user. have installed plugin email confirmation 2.0.8. using grails 2.3.7 version. , have done following attempt although have no idea it. no email being sent in yahoo account. can me on please ? here attempts follows :
in config file plugin >>>
plugin.emailconfirmation.from = '"do not reply" <noreply@mymegacorp.com>'
in view page >>>
<g:form controller="userinformation" action="saveuserinfo"> user e-mail address : <g:textfield name="useremail" id="useremail" required=""/> <br/> <g:submitbutton name="submit" id="submit" value="save user"/> </g:form>
in controller action >>>
def saveuserinfo() { println(params) // send simple confirmation emailconfirmationservice.sendconfirmation( to:params.useremail, subject:"please confirm!") }
edit :: here new config file >>>
// locations search config files merged main config; // config files can configslurper scripts, java properties files, or classes // in classpath in configslurper format // grails.config.locations = [ "classpath:${appname}-config.properties", // "classpath:${appname}-config.groovy", // "file:${userhome}/.grails/${appname}-config.properties", // "file:${userhome}/.grails/${appname}-config.groovy"] // if (system.properties["${appname}.config.location"]) { // grails.config.locations << "file:" + system.properties["${appname}.config.location"] // } grails.project.groupid = appname // change alter default package name , maven publishing destination // accept header not used content negotiation user agents containing following strings (defaults 4 major rendering engines) grails.mime.disable.accept.header.useragents = ['gecko', 'webkit', 'presto', 'trident'] grails.mime.types = [ // first 1 default format all: '*/*', // 'all' maps '*' or first available format in withformat atom: 'application/atom+xml', css: 'text/css', csv: 'text/csv', form: 'application/x-www-form-urlencoded', html: ['text/html','application/xhtml+xml'], js: 'text/javascript', json: ['application/json', 'text/json'], multipartform: 'multipart/form-data', rss: 'application/rss+xml', text: 'text/plain', hal: ['application/hal+json','application/hal+xml'], xml: ['text/xml', 'application/xml'] ] // url mapping cache max size, defaults 5000 //grails.urlmapping.cache.maxsize = 1000 // url patterns should processed resources plugin grails.resources.adhoc.patterns = ['/images/*', '/css/*', '/js/*', '/plugins/*'] grails.resources.adhoc.includes = ['/images/**', '/css/**', '/js/**', '/plugins/**'] // legacy setting codec used encode data ${} grails.views.default.codec = "html" // default scope controllers. may prototype, session or singleton. // if unspecified, controllers prototype scoped. grails.controllers.defaultscope = 'singleton' // gsp settings grails { views { gsp { encoding = 'utf-8' htmlcodec = 'xml' // use xml escaping instead of html4 escaping codecs { expression = 'html' // escapes values inside ${} scriptlet = 'html' // escapes output scriptlets in gsps taglib = 'none' // escapes output taglibs staticparts = 'none' // escapes output static template parts } } // escapes not-encoded output @ final stage of outputting // filteringcodecforcontenttype.'text/html' = 'html' } } grails.converters.encoding = "utf-8" // scaffolding templates configuration grails.scaffolding.templates.domainsuffix = 'instance' // set false use new grails 1.2 jsonbuilder in render method grails.json.legacy.builder = false // enabled native2ascii conversion of i18n properties files grails.enable.native2ascii = true // packages include in spring bean scanning grails.spring.bean.packages = [] // whether disable processing of multi part requests grails.web.disable.multipart=false // request parameters mask when logging exceptions grails.exceptionresolver.params.exclude = ['password'] // configure auto-caching of queries default (if false can cache individual queries 'cache: true') grails.hibernate.cache.queries = false // configure passing transaction's read-only attribute hibernate session, queries , criterias // set "singlesession = false" osiv mode in hibernate configuration after enabling grails.hibernate.pass.readonly = false // configure passing read-only osiv session default, requires "singlesession = false" osiv mode grails.hibernate.osiv.readonly = false environments { development { grails.logging.jul.usebridge = true } production { grails.logging.jul.usebridge = false // todo: grails.serverurl = "http://www.changeme.com" } } // log4j configuration log4j = { // example of changing log pattern default console appender: // //appenders { // console name:'stdout', layout:pattern(conversionpattern: '%c{2} %m%n') //} error 'org.codehaus.groovy.grails.web.servlet', // controllers 'org.codehaus.groovy.grails.web.pages', // gsp 'org.codehaus.groovy.grails.web.sitemesh', // layouts 'org.codehaus.groovy.grails.web.mapping.filter', // url mapping 'org.codehaus.groovy.grails.web.mapping', // url mapping 'org.codehaus.groovy.grails.commons', // core / classloading 'org.codehaus.groovy.grails.plugins', // plugins 'org.codehaus.groovy.grails.orm.hibernate', // hibernate integration 'org.springframework', 'org.hibernate', 'net.sf.ehcache.hibernate' } // email confirmation configration -- (plugin) plugin.emailconfirmation.from = '"do not reply" <noreply@mymegacorp.com>' // mail plugin configuration //grails { // mail { // host = "smtp.correo.yahoo.es" // port = 465 // username = "bappi_sumon@yahoo.com" // password = "password" // props = [ "mail.smtp.auth":"true", // "mail.smtp.socketfactory.port":"465", // "mail.smtp.socketfactory.class":"javax.net.ssl.sslsocketfactory", // "mail.smtp.socketfactory.fallback":"false" ] // } //} grails { mail { host = "smtp.gmail.com" port = 465 username = "pshoikot@gmail.com" password = "password" props = ["mail.smtp.auth":"true", "mail.smtp.socketfactory.port":"465", "mail.smtp.socketfactory.class":"javax.net.ssl.sslsocketfactory", "mail.smtp.socketfactory.fallback":"false"] } }
here view send email not confirmation >>>
<g:form controller="sendmail" action="sendmail"> <g:submitbutton name="submit" value="send mail"/> </g:form>
here action sending email >>>
def mailservice def sendmail() { mailservice.sendmail { "bappi_sumon@yahoo.com" "bappi_sumon@yahoo.com" subject "hello bappi" body 'this text' } }
my view send confirmation >>>
<g:form controller="userinformation" action="saveuserinfo"> user e-mail address : <g:textfield name="useremail" id="useremail" required=""/> <br/> <g:submitbutton name="submit" id="submit" value="save user"/> </g:form>
my action send confirmation >>>
def emailconfirmationservice def saveuserinfo() { println(params) // send simple confirmation emailconfirmationservice.sendconfirmation( to:params.useremail, subject:"please confirm!") }
check config file , edit host server port number , give username or password.
and try async mail send in grails. http://fletchermcbeth.wordpress.com/2009/06/16/sending-email-from-grails/
Comments
Post a Comment