使用Gmail帐户配置JBoss中的mail-service.xml [英] Configure the mail-service.xml in JBoss with a Gmail account

查看:121
本文介绍了使用Gmail帐户配置JBoss中的mail-service.xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想配置我的mail-service.xml来从我的Gmail帐户发送电子邮件。我已经做了一个配置,但它不工作

I want to configure my mail-service.xml to send emails from my Gmail account. I have made a configuration, but it doesn't work

<?xml version="1.0" encoding="UTF-8"?>
<server>
  <mbean code="org.jboss.mail.MailService"
         name="jboss:service=Mail">
    <attribute name="JNDIName">java:/Mail</attribute>
    <attribute name="User">***@gmail.com</attribute>
    <attribute name="Password">***</attribute>
    <attribute name="Configuration">
      <configuration>
        <property name="mail.smtp.auth" value="true"/>
        <property name="mail.smtp.starttls.enable" value="true"/>
        <property name="mail.smtp.socketFactory.class" value="javax.net.ssl.SSLSocketFactory"/>

        <!-- Change to your mail server prototocol -->
        <property name="mail.store.protocol" value="pop3"/>
        <property name="mail.transport.protocol" value="smtp"/>

        <!-- Change to the user who will receive mail  -->
        <property name="mail.user" value="nobody"/>

        <!-- Change to the mail server  -->
        <property name="mail.pop3.host" value="pop3.nosuchhost.nosuchdomain.com"/>

        <!-- Change to the SMTP gateway server -->
        <property name="mail.smtp.host" value="smtp.gmail.com"/>

        <!-- The mail server port -->
        <property name="mail.smtp.port" value="465"/>

        <!-- Change to the address mail will be from  -->
        <property name="mail.from" value="nobody@nosuchhost.nosuchdomain.com"/>

        <!-- Enable debugging output from the javamail classes -->
        <property name="mail.debug" value="false"/>
      </configuration>
    </attribute>
    <depends>jboss:service=Naming</depends>
  </mbean>

</server>


推荐答案

我也在努力,但最终得到了工作。我写了我在这里做的:

I struggled with this too, but eventually got it working. I wrote up what I did here:

http://mrmcgeek.blogspot.com/2010/09/confguring-java-mail-with-jboss-as-5.html

您需要将以下内容添加到mail-service.xml中:

You need to add the following to the mail-service.xml:

<property name="mail.smtp.user" value="${username}@gmail.com" />
<property name="mail.smtp.password" value="${password}" />
<property name="mail.smtp.ssl.enable" value="true" />

这篇关于使用Gmail帐户配置JBoss中的mail-service.xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆