我想配置我的 mail-service.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="[email protected] /cdn-cgi/l/email-protection"/>
<!-- Enable debugging output from the javamail classes -->
<property name="mail.debug" value="false"/>
</configuration>
</attribute>
<depends>jboss:service=Naming</depends>
</mbean>
</server>
我也为此苦苦挣扎,但最终还是成功了。我在这里写下了我所做的事情:
http://mrmcgeek.blogspot.com/2010/09/confguring-java-mail-with-jboss-as-5.html http://mrmcgeek.blogspot.com/2010/09/confguring-java-mail-with-jboss-as-5.html
您需要将以下内容添加到 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" />
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)