小编Seb*_*tos的帖子

如何使用GMail在Websphere中使用默认Javamail会话

我正在尝试在Websphere 7中创建一个javamail会话来使用GMail,但我的身份验证总是失败.

是的,我的密码还可以......

我正在将Session配置为:

输出邮件属性

  • 提供商:内置邮件提供商
  • JNDI:mail/session/Default
  • 调试:开
  • 服务器:smtp.gmail.com
  • 协议:smtp
  • 用户:myuser@gmail.com
  • 密码:mypassword
  • 确认密码:与上述相同
  • 返回邮箱:myuser@gmail.com

在会话属性中,我有:

  • mail.smtp.auth = true
  • mail.smtp.port = 465
  • mail.smtp.starttls.enable = true
  • mail.smtp.socketFactory.port = 465
  • mail.smtp.socketFactory.class = javax.net.ssl.SSLSocketFactory

我正在使用类似于...的测试JSP

...
System.out.println("Entering MailJsp!");

String errorMessage = null;
String destinationAddress = request.getParameter("destinationAddress");
String messageBody = request.getParameter("message");
String subject = "Mail from MailServlet";
String emailFrom = "myuser@gmail.com"; 

// try only if it is not the first request
if (destinationAddress != null) {

    System.out.println("Sending email");
    try 
    {
        // look up MailSession
        Context …
Run Code Online (Sandbox Code Playgroud)

session websphere gmail jakarta-mail

5
推荐指数
1
解决办法
7756
查看次数

标签 统计

gmail ×1

jakarta-mail ×1

session ×1

websphere ×1