• Post Reply Bookmark Topic Watch Topic
  • New Topic

package error  RSS feed

 
abi lash
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,



"Below shown is a code written for send a mail using java mail API concept, Can anyone tell why iam getting error as shown below"

import javax.mail.*;//error here
import javax.mail.internet.*;//error here

public class Abhi1 {

public static void main(String[] args) throws Exception {
String host = "smtp.mydomain.com";
String from = "me@myweb.com";
String to = "you@myweb.com ";
Properties prop = System.getProperties();
prop.put("mail.smtp.host",host);
Session sess1 = Session.getDefaultInstance(prop,null);
Mimemessage msg = new MimeMessage(sess1);
msg.setFrom(new InternetAddress(from));
msg.addRecipient(Message.RecipientType.To,new InternetAddress(to));
msg.setText("you won the lotri");
Transport.send(msg
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please do not post the same question multiple times. Let's continue the discussion in this duplicate thread, where you have an answer already.
[ January 02, 2007: Message edited by: Ulf Dittmer ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!