Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
grails中的电子邮件验证_Grails_Grails 2.0_Grails Plugin - Fatal编程技术网

grails中的电子邮件验证

grails中的电子邮件验证,grails,grails-2.0,grails-plugin,Grails,Grails 2.0,Grails Plugin,我是grails新手,正在grails中开发一个web应用程序 在我的注册页面中,我正在获取用户的电子邮件id,我需要发送一封带有身份验证链接的邮件 我已经参考了这些页面和许多其他页面来完成这项任务。 但问题是,我的电子邮件没有发送 我用过 Gmail SMTP server address : smtp.gmail.com Gmail SMTP username : myid@gmail.com Gmail SMTP password : -my password- Gmail SMTP

我是grails新手,正在grails中开发一个web应用程序

在我的注册页面中,我正在获取用户的电子邮件id,我需要发送一封带有身份验证链接的邮件

我已经参考了这些页面和许多其他页面来完成这项任务。 但问题是,我的电子邮件没有发送

我用过

Gmail SMTP server address : smtp.gmail.com
Gmail SMTP username : myid@gmail.com
Gmail SMTP password : -my password-
Gmail SMTP port : 465
Gmail SMTP TLS/SSL required : yes
邮件设置为:

grails { 
    mail { 
        host = "smtp.gmail.com" 
        port = 465 
        username = "myId@gmail.com" 
        password = "mypassword" 
        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.default.from="noreply@gmail.com"
但至少

sendMail {     
  to "friend@gmail.com"     
  subject "Hello "     
  body 'How are you?' 
}
它不起作用

发生的异常为

Error 500: Internal Server Error

URI
    /MailVerificationDemo/user/signup/form
Class
    java.net.ConnectException
Message
    Connection refused

Around line 104 of MailMessageBuilder.groovy

101:            log.trace("Sending mail ${getDescription(message)}} ...")102:        }103:104:        mailSender.send(message instanceof MimeMailMessage ? message.mimeMessage : message)105:106:        if (log.traceEnabled) {107:            log.trace("Sent mail ${getDescription(message)}} ...")

Around line 41 of grails-app/services/grails/plugin/mail/MailService.groovy

38:        callable.resolveStrategy = Closure.DELEGATE_FIRST39:        callable.call()40:41:        messageBuilder.sendMessage()42:    }43:44:    def getMailConfig() {

Around line 18 of grails-app/controllers/user/UserController.groovy

15:            return16:        }17:18:        mailService.sendMail {19:            to userInstance.email20:            subject "New User Confirmation"21:            html g.render(template:"mailtemplate",model:[code:userInstance.confirmCode])

Around line 195 of PageFragmentCachingFilter.java

192:            if (CollectionUtils.isEmpty(cacheOperations)) {193:             log.debug("No cacheable annotation found for {}:{} {}",194:                     new Object[] { request.getMethod(), request.getRequestURI(), getContext() });195:               chain.doFilter(request, response);196:              return;197:         }198:

Around line 63 of AbstractFilter.java

60:     try {61:            // NO_FILTER set for RequestDispatcher forwards to avoid double gzipping62:         if (filterNotDisabled(request)) {63:                doFilter(request, response, chain);64:          }65:            else {66:               chain.doFilter(req, res);

试试这个,它对我有用。 请注意:
Gmail SMTP TLS/SSL必需:是。
但是您没有将
“mail.smtp.starttls.enable”:“true”


从config.groovy粘贴邮件设置。你有什么错误吗?发生了什么,你们看到控制台上有什么东西吗!grails{mail{host=“smtp.gmail.com”端口=465用户名=”myId@gmail.com“password=“mypassword”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.default.from=”noreply@gmail.com“查看页面没有更改。您可以使用这些凭据登录到
Gmail
Gmail
通常在第一次拒绝来自未知客户端的连接。在您的收件箱中查找此邮件的电子邮件通知。还请检查我是否已经尝试了所有这些。。。。但仍然是相同的错误。因为跟踪表明使用了ssl,所以您的配置很可能被拾取。你能测试连接吗?e、 g.
telnet smtp.gmail.com 465
grails.mail.host="smtp.gmail.com"
grails.mail.port=587
grails.mail.username="yourUsernameHere"
grails.mail.password="yourPwdHere"
grails.mail.from="defaultMailFromHere"
grails.mail.props = ['mail.smtp.auth': "true",
        "mail.smtp.starttls.enable": "true",
        "mail.from":"defaultMailFromHere"]
grails.mail.javaMailProperties = ['mail.smtp.auth': "true",
        "mail.smtp.starttls.enable": "true",
        "mail.from":"defaultMailFromHere"]