代码之家  ›  专栏  ›  技术社区  ›  Marouane Gazanayi

配置邮件-服务.xml在JBoss上有一个Gmail帐户

  •  6
  • Marouane Gazanayi  · 技术社区  · 16 年前

    我想配置我的邮件-服务.xml从我的Gmail账户发邮件。我做了一个配置,但不起作用

    <?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>
    
    2 回复  |  直到 16 年前
        1
  •  8
  •   Andy Mc    16 年前

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

    您需要在邮件中添加以下内容-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" />
    
        2
  •  1
  •   Gayathri Rajan    11 年前

    你没有安排主持人好的。试试看这个

    <?xml version="1.0" encoding="UTF-8"?>
    <!-- $Id: mail-service.xml 62350 2007-04-15 16:50:12Z dimitris@jboss.org $ -->
    <server>
    <mbean code="org.jboss.mail.MailService"
     name="jboss:service=Mail">
    <attribute name="JNDIName">java:/Mail</attribute>
    <attribute name="User">type sender mail id here</attribute>
    <attribute name="Password">type password</attribute>   
    <attribute name="Configuration">
    <!-- A test 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 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=""/>
    
    <!-- Enable debugging output from the javamail classes -->
    <property name="mail.debug" value="false"/>
    </configuration>
    </attribute>
    <depends>jboss:service=Naming</depends>
    </mbean>
    </server>