473,386 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

JAVAMail question

im new to the the mail stuff and smtp stuff .. im trying to make a module to send email ... here is my code and the error it returns is:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/activation/DataSource
at src.lacrown.Mail.main(Mail.java:35)

this line:MimeMessage message = new MimeMessage(s);
what could be wrong? or what am i missing?

thanks in advance


import java.util.*;
import javax.mail.*;

import javax.mail.internet.*;

public class Mail {
static String msgText1 = "This is a message body.\nHere's line two.";
static String msgText2 = "This is the text in the message attachment.";

public static void main(String[] args) throws MessagingException {
Properties props = new Properties();
props.put("lacoronahotels.com", "lacoronahotels.com");
Session s = Session.getInstance(props,null);


InternetAddress from = new InternetAddress("akoymakoy@yahoo.com");
InternetAddress to = new InternetAddress("akoymakoyg@yahoo.com");

MimeMessage message = new MimeMessage(s);
message.setFrom(from);
message.addRecipient(Message.RecipientType.TO, to);

message.setSubject("Your subject");
message.setText("Your text");
Transport.send(message);
}
}
Feb 7 '08 #1
3 1908
MarkoKlacar
296 Expert 100+
Hi,

There must exist a lot of tutorials on how to send mail using Java, this one is pretty straight forward, match you code aginst it and you'll get your solution.

Good luck
Feb 7 '08 #2
JosAH
11,448 Expert 8TB
im new to the the mail stuff and smtp stuff .. im trying to make a module to send email ... here is my code and the error it returns is:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/activation/DataSource
at src.lacrown.Mail.main(Mail.java:35)

this line:MimeMessage message = new MimeMessage(s);
what could be wrong? or what am i missing?
What is the Java version you're running? For the activation framework you need
at least Java 1.4

kind regards,

Jos
Feb 7 '08 #3
hi im using java 1.5
Feb 13 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Jonatan Fernstad | last post by:
I am using the JavaMail API to send email. It seems the Message.setSentDate(new Date()) sets wrong time zone. I am at GMT+1, and this is also what the new Date() is showing. But when the...
0
by: pcouas | last post by:
Hi, Anyone know how reading Outlook or Outlook express contact File from Javamail ? It seems theses files are named .dbx and .vba Thanks Philippe
1
by: Daniel Albisser | last post by:
Hi @ll, I was wondering why I lose the connection to the mail store while retrieving information from it without calling the method store.close()! At the end I found out that the method...
0
by: Volker Jahns | last post by:
hi together. public void sendMail(String body, String subject, String sender, String to, String copy) { String server = "srv.domain.com"; String toList = null; Properties props = new...
0
by: John P | last post by:
Hello, I'm building email messages and attachments via the JavaMail API, which are then sent via sendmail. The attachments are mime attachments of type "application/octet-stream". They are...
1
by: Jeff | last post by:
I'm finding that as I loop through a large pop store and reading each message into an input stream that the JVM is running out of memory for the case where the pop store is large (several thousand...
1
by: Joshua | last post by:
Ive playedw ith the standard pop3 and imap and nntp and smtp modules but am unconvinced -- I would like to find a more sophisticated email handling API like JavaMail (from which I hope to convert)....
0
by: sandeepk84 | last post by:
Hi all... I am facing a problem in getting attachments from Yahoo Classic using JavaMail. My program reads the attachments from gmail and Yahoo Beta. But attachments of type pdf or txt from...
5
by: rengaraj | last post by:
Hello , I try a simple javamail program to send a mail.When i execute that javamail program, i got the error as follows import java.util.*; import javax.mail.*; import...
0
by: libia | last post by:
Hello, I want to send a mail using java program .so i used javamail 1.4 and jaf 1.1.It was compiled successfully.If i run the program it gives the error that "unable to connect" to port 25.If...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.