Hi there, I am using Jboss 3.2.3 and I ahve a simple JavaMail program that runs 
perfectly on a standalone system (non-J2EE) but fails while running in Jboss...

public void postMail(String recipient, String subject, String message, String from) 
throws MessagingException, UnsupportedEncodingException {
  |         boolean debug = true;
  | 
  | 
  |         Properties props = new Properties();
  |         props.put("mail.smtp.host", smtpHost);
  | 
  |         props.put("mail.smtp.auth", "true");
  | 
  |         Session session = Session.getDefaultInstance(props);
  |         session.setDebug(debug);
  |         Transport trans = session.getTransport("smtp");
  |         trans.connect(null, name, password);
  | 
  |         Address toAddr[] = {new InternetAddress(from)};
  | 
  |         Address fromAddr[] =
  |                 fromAddr = new Address[]{new InternetAddress(from, "My Name")};
  | 
  |         Message msg = new MimeMessage(session);
  | 
  |         msg.setRecipient(Message.RecipientType.TO, toAddr[0]);
  |         msg.setFrom(fromAddr[0]);
  |         msg.setReplyTo(fromAddr);
  |         msg.setSubject("Test2");
  |         msg.setContent("This is a test - you can safely ignore this message", 
"text/plain");
  | 
  |         trans.sendMessage(msg, toAddr);
  |     }
  | 
  |     public static void main(String args[]) throws Exception {
  |         String from = args[0];
  |         String to = args[1];
  |         MailExample mailExample = new MailExample();
  |         mailExample.postMail("[EMAIL PROTECTED]","test subject", "a 
message","[EMAIL PROTECTED]");
  |     }
While sucessfuly sending Email on a stand-alone system, running from my webapplication 
I get:
  | javax.mail.MessagingException: 530 MAIL requires AUTH
  | 
  |     at com.sun.mail.smtp.SMTPTransport.issueCommand(SMTPTransport.java:923)
  |     at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:643)
  |     at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:322)
  |     at com.snap.email.MailExample.postMail(MailExample.java:47)

Any ideas?

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3833254#3833254

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3833254


-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE. 
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to