• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

package error

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Master Rancher
Posts: 43045
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
reply
    Bookmark Topic Watch Topic
  • New Topic