You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by Jack Wang <pi...@yahoo.com> on 2006/07/20 02:29:10 UTC

Sending mail with geronimo-spec-j2ee-1.4-rc4.jar problem

In my app lib, there are geronimo-spec-j2ee-1.4-rc4.jar, which has mail api.When I send mail with
MimeBodyPart and MimeBodyPart, the error message is:

Exception in thread "main" java.lang.UnsupportedOperationException: Method not yet implemented
	at javax.mail.internet.MimeBodyPart.setFileName(MimeBodyPart.java:167)
	at test.HtmlJavaMail.sendMail(Unknown Source)
	at test.HtmlJavaMail.main(Unknown Source)


When I remove geronimo-spec-j2ee-1.4-rc4.jar and left the mail.jar, there is no problem.

So I think there is any conflict between geronimo-spec-j2ee-1.4-rc4.jar and mail.jar. How can I
resolve this problem ? 



----------------------------------------------------------
sendMethod() {	
	Properties props = new Properties();

	props.put("mail.smtp.host", MailSettings.smtpHost);
	props.put("mail.debug","true");
	props.put("mail.smtp.auth","true");	
	Session session = Session.getDefaultInstance(props, new ForcedAuthenticator());

	Message message = new MimeMessage(session);

	message.setFrom(new InternetAddress(MailSettings.fromAddress,
			MailSettings.fromName));

	message.setRecipient(Message.RecipientType.TO, new InternetAddress(
			MailSettings.toAddress));

	message.setSubject(MailSettings.messageSubject);

	MimeMultipart multipart=new MimeMultipart();
	
	BodyPart msgBodyPart=new MimeBodyPart();
	String contentType= msgBodyPart.getContentType();
	
	String msg = "<H1>Hi! From HtmlJavaMail Chinese=中文</H1><img src=\"cid:logo\">";

	msgBodyPart.setContent(msg,"text/html;charset=gbk");
	
	MimeBodyPart mBodyContent=new MimeBodyPart();
	FileDataSource theDs = new FileDataSource("D:\\abc.txt");  
	mBodyContent.setDataHandler(new DataHandler(theDs));
	String attachedFileName = "abc.txt";
	attachedFileName = MimeUtility.encodeText(attachedFileName,"gbk","B");
	mBodyContent.setFileName(attachedFileName);	
	multipart.addBodyPart(mBodyContent);
	
	multipart.addBodyPart(msgBodyPart);
	
	message.setContent(multipart);

	message.setSentDate(new Date());

	Transport.send(message);
}
		

class ForcedAuthenticator extends Authenticator {
	public PasswordAuthentication getPasswordAuthentication() {
		return new PasswordAuthentication(MailSettings.smtpUsername,
				MailSettings.smtpPassword);
	}
}


Jack Wang


	

	
		
___________________________________________________________ 
Mp3疯狂搜-新歌热歌高速下
http://music.yahoo.com.cn/?source=mail_mailbox_footer

---------------------------------------------------------------------
To unsubscribe, e-mail: kandula-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: kandula-dev-help@ws.apache.org


Re: Sending mail with geronimo-spec-j2ee-1.4-rc4.jar problem

Posted by Dasarath Weeratunge <dw...@purdue.edu>.
Quoting Jack Wang <pi...@yahoo.com>:

Jack, Please fwd this to geronimo user list. Let us also know there reply.

thanks,
--dasarath

> In my app lib, there are geronimo-spec-j2ee-1.4-rc4.jar, which has mail
> api.When I send mail with
> MimeBodyPart and MimeBodyPart, the error message is:
> 
> Exception in thread "main" java.lang.UnsupportedOperationException: Method
> not yet implemented
> 	at javax.mail.internet.MimeBodyPart.setFileName(MimeBodyPart.java:167)
> 	at test.HtmlJavaMail.sendMail(Unknown Source)
> 	at test.HtmlJavaMail.main(Unknown Source)
> 
> 
> When I remove geronimo-spec-j2ee-1.4-rc4.jar and left the mail.jar, there is
> no problem.
> 
> So I think there is any conflict between geronimo-spec-j2ee-1.4-rc4.jar and
> mail.jar. How can I
> resolve this problem ? 
> 
> 
> 
> ----------------------------------------------------------
> sendMethod() {	
> 	Properties props = new Properties();
> 
> 	props.put("mail.smtp.host", MailSettings.smtpHost);
> 	props.put("mail.debug","true");
> 	props.put("mail.smtp.auth","true");	
> 	Session session = Session.getDefaultInstance(props, new
> ForcedAuthenticator());
> 
> 	Message message = new MimeMessage(session);
> 
> 	message.setFrom(new InternetAddress(MailSettings.fromAddress,
> 			MailSettings.fromName));
> 
> 	message.setRecipient(Message.RecipientType.TO, new InternetAddress(
> 			MailSettings.toAddress));
> 
> 	message.setSubject(MailSettings.messageSubject);
> 
> 	MimeMultipart multipart=new MimeMultipart();
> 	
> 	BodyPart msgBodyPart=new MimeBodyPart();
> 	String contentType= msgBodyPart.getContentType();
> 	
> 	String msg = "<H1>Hi! From HtmlJavaMail Chinese=ÖÐÎÄ</H1><img
> src=\"cid:logo\">";
> 
> 	msgBodyPart.setContent(msg,"text/html;charset=gbk");
> 	
> 	MimeBodyPart mBodyContent=new MimeBodyPart();
> 	FileDataSource theDs = new FileDataSource("D:\\abc.txt");  
> 	mBodyContent.setDataHandler(new DataHandler(theDs));
> 	String attachedFileName = "abc.txt";
> 	attachedFileName = MimeUtility.encodeText(attachedFileName,"gbk","B");
> 	mBodyContent.setFileName(attachedFileName);	
> 	multipart.addBodyPart(mBodyContent);
> 	
> 	multipart.addBodyPart(msgBodyPart);
> 	
> 	message.setContent(multipart);
> 
> 	message.setSentDate(new Date());
> 
> 	Transport.send(message);
> }
> 		
> 
> class ForcedAuthenticator extends Authenticator {
> 	public PasswordAuthentication getPasswordAuthentication() {
> 		return new PasswordAuthentication(MailSettings.smtpUsername,
> 				MailSettings.smtpPassword);
> 	}
> }
> 
> 
> Jack Wang
> 
> 
> 	
> 
> 	
> 		
> ___________________________________________________________ 
> Mp3·è¿ñËÑ-иèÈȸè¸ßËÙÏÂ
> http://music.yahoo.com.cn/?source=mail_mailbox_footer
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: kandula-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: kandula-dev-help@ws.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: kandula-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: kandula-dev-help@ws.apache.org


Re: Sending mail with geronimo-spec-j2ee-1.4-rc4.jar problem

Posted by Dasarath Weeratunge <dw...@purdue.edu>.
Quoting Jack Wang <pi...@yahoo.com>:

Jack, Please fwd this to geronimo user list. Let us also know there reply.

thanks,
--dasarath

> In my app lib, there are geronimo-spec-j2ee-1.4-rc4.jar, which has mail
> api.When I send mail with
> MimeBodyPart and MimeBodyPart, the error message is:
> 
> Exception in thread "main" java.lang.UnsupportedOperationException: Method
> not yet implemented
> 	at javax.mail.internet.MimeBodyPart.setFileName(MimeBodyPart.java:167)
> 	at test.HtmlJavaMail.sendMail(Unknown Source)
> 	at test.HtmlJavaMail.main(Unknown Source)
> 
> 
> When I remove geronimo-spec-j2ee-1.4-rc4.jar and left the mail.jar, there is
> no problem.
> 
> So I think there is any conflict between geronimo-spec-j2ee-1.4-rc4.jar and
> mail.jar. How can I
> resolve this problem ? 
> 
> 
> 
> ----------------------------------------------------------
> sendMethod() {	
> 	Properties props = new Properties();
> 
> 	props.put("mail.smtp.host", MailSettings.smtpHost);
> 	props.put("mail.debug","true");
> 	props.put("mail.smtp.auth","true");	
> 	Session session = Session.getDefaultInstance(props, new
> ForcedAuthenticator());
> 
> 	Message message = new MimeMessage(session);
> 
> 	message.setFrom(new InternetAddress(MailSettings.fromAddress,
> 			MailSettings.fromName));
> 
> 	message.setRecipient(Message.RecipientType.TO, new InternetAddress(
> 			MailSettings.toAddress));
> 
> 	message.setSubject(MailSettings.messageSubject);
> 
> 	MimeMultipart multipart=new MimeMultipart();
> 	
> 	BodyPart msgBodyPart=new MimeBodyPart();
> 	String contentType= msgBodyPart.getContentType();
> 	
> 	String msg = "<H1>Hi! From HtmlJavaMail Chinese=ÖÐÎÄ</H1><img
> src=\"cid:logo\">";
> 
> 	msgBodyPart.setContent(msg,"text/html;charset=gbk");
> 	
> 	MimeBodyPart mBodyContent=new MimeBodyPart();
> 	FileDataSource theDs = new FileDataSource("D:\\abc.txt");  
> 	mBodyContent.setDataHandler(new DataHandler(theDs));
> 	String attachedFileName = "abc.txt";
> 	attachedFileName = MimeUtility.encodeText(attachedFileName,"gbk","B");
> 	mBodyContent.setFileName(attachedFileName);	
> 	multipart.addBodyPart(mBodyContent);
> 	
> 	multipart.addBodyPart(msgBodyPart);
> 	
> 	message.setContent(multipart);
> 
> 	message.setSentDate(new Date());
> 
> 	Transport.send(message);
> }
> 		
> 
> class ForcedAuthenticator extends Authenticator {
> 	public PasswordAuthentication getPasswordAuthentication() {
> 		return new PasswordAuthentication(MailSettings.smtpUsername,
> 				MailSettings.smtpPassword);
> 	}
> }
> 
> 
> Jack Wang
> 
> 
> 	
> 
> 	
> 		
> ___________________________________________________________ 
> Mp3·è¿ñËÑ-иèÈȸè¸ßËÙÏÂ
> http://music.yahoo.com.cn/?source=mail_mailbox_footer
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: kandula-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: kandula-dev-help@ws.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: kandula-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: kandula-dev-help@ws.apache.org