 |
|
 |
Sir
I'm Sourabh Usta form India, i am studing in VBPC College, Udaipur. i am creating a Email Reader (look like Microsoft outlook) software using Java. i face lots more problem to develop software. sir what i do. would you like to help me. i have no idea to develop this project. Provide me Codes plzzzzz
|
|
|
|
 |
hi sir following error when i run program...
and how to set class path.... for mail.jar,activation.jar etc...
D:\java\Java_Mail_demozip
D:\java\Java_Mail_demozip>javac SendMail.java
Note: SendMail.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
D:\java\Java_Mail_demozip>java SendMail
Exception in thread "main" java.lang.NoSuchMethodError: main
please help me
|
|
|
|
 |
Hi
I have put all the required jar files in the classpath but find the above error when running your code. Is this error due to SMTP host name as I find that 'arecord' value returns null. can you please help?
|
|
|
|
 |
Hi
I am reading mail using java mail API and its content type is text/html and showing transfer-content type as Quoted-printable or Base64. As i need to fetch some information from mail but due to these transfer content type i am getting some unwanted text also like "=20" etc. Please tell me how to decode Quoted printable as well as Base64 message.
Thanks and Regards,
Shikha Virmani
|
|
|
|
 |
This may help you
http://stackoverflow.com/questions/2764504/getting-base64-content-string-of-an-image-from-a-mimepart-in-java
visit www.mohamedashraf.tk
|
|
|
|
 |
I am reading mail content using javamail only. I may get mail from "HTML", "RTF" or "Plain text format.If i am getting mail in "RTF" format, i need to show that in RTF format.(Ex: if we have table in mail, should show same table structure with content). If i am getting mail from HTML format, i need to show that in "HTML" format(Ex: if i have any hyperlink, it should display as link. if i have any table, should show in table format.
Presently, If i am getting mail as HTML format, read mail showing in the applicationlike, "testing for value
testing...."
I need to show in html format.
hel pme please
|
|
|
|
 |
Hi,
Check the content and use this appropriate
MimeMultipart content = new MimeMultipart("alternative");
MimeBodyPart text = new MimeBodyPart();
MimeBodyPart html = new MimeBodyPart();
text.setText( "Your text content" );
text.setHeader("MIME-Version" , "1.0" );
text.setHeader("Content-Type" , text.getContentType() );
html.setContent("Your html content", "text/html");
html.setHeader("MIME-Version" , "1.0" );
html.setHeader("Content-Type" , html.getContentType() );
content.addBodyPart(text);
content.addBodyPart(html);
message.setContent( content )
message.setHeader("MIME-Version" , "1.0" );
message.setHeader("Content-Type" , content.getContentType() );
message.setHeader("X-Mailer", "Recommend-It Mailer V2.03c02");
Hope this helps,
- Mohashar
visit www.mohamedashraf.tk
|
|
|
|
 |
i wanna ask abt what u actually need to do to send an Email using java code that u gave.
the code that is here i got an error in this line
org.xbill.DNS.Record arecord[] = (new Lookup(smtphost, (short)15)).run();
what is it.
like can we just easily send email just writing these lines in our app.
|
|
|
|
 |
If you would have given valid smtphost then it will not give any error. This is a simple program which gives some idea about java mail. This not meant for intermediate/higher level java programmars.
visit www.mohamedashraf.tk
|
|
|
|
 |
When we create logger object.It is locked.If requrinment is to read lines of logger file and create new automaticaly how can we do
|
|
|
|
 |
I think you can read the stream. i.e., read the characters while creating a file.
visit www.mohamedashraf.tk
|
|
|
|
 |
How to solve this problem ?
|
|
|
|
 |
Hi,
I did as per instructions, i downloaded your test application
but i m getting this error: Initializaiton Block = Null.
It goes into the catch loop at
org.xbill.DNS.Record arecord[] = (new Lookup(smtphost, (short)15)).run();
// Store all SMTP hosts and their Priority
for(int j = 0; j < arecord.length; j++)
it is getting null at the length!!!!
Then i tried to modify the code, by removing the above FOR loop and made the adjustemnts, so that i have only one smtphost...i hardcoded the IP address(i have confirmed that this is indeed the correct ip address)
But now i am getting the error:
Error in sending Address Try.........Invalid Addresses;
nested exception is:class com.sun.mail.smtp.SMTPAddressFailedException: 554 Relay rejected for policy reasons.
This time it goes into catch at : Transport.send(mimemessage);
I checked, it is when i use the "cc". If i comment the cc part, then it runs successfully
I am using:
Eclipse SDK
Version: 3.1.2
Build id: M20060118-1600
JDK1.5.0
Any help will be greatly appreciated!!!!
-- modified at 13:08 Wednesday 22nd August, 2007
|
|
|
|
 |
i follow all steps but in running i get this exception
Mailing Process Started ............
strPriority=[10];strHostName=[smtp3.google.com.]
strPriority=[10];strHostName=[smtp4.google.com.]
strPriority=[10];strHostName=[smtp1.google.com.]
strPriority=[10];strHostName=[smtp2.google.com.]
Error in sending Address Try.........Could not connect to SMTP host: smtp3.google.com., port: 25;
nested exception is:
java.net.ConnectException: Connection timed out: connect
Mailing Process Ended ............
|
|
|
|
 |
Seems smtp server connect problems..Try this to checkthe smtp connection
Hi,
your smtp server is not relaying to the gmail server...you can check this using these steps
Take cmd prompt
1. c:> telnet smtp_servername 25
2. helo
3. mail from: [email protected]
4. rcpt to: [email protected]
5. data
test mail
.
Do the above steps one bye one
Hope this helps
Cheers,
Mohashar
visit www.mohamedashraf.tk
|
|
|
|
 |
Hi.
Thanks for the great tutorial.
I have a problem, however. I code in java servlets using smtpClient class to send mails, but am unable to send mails to outside servers(eg. gmail.com). the mailing list software however can send mails to all hosts.
Please find time to answer this soon.
Thanks and regards
Rudraxi Parashar
|
|
|
|
 |
Hi,
your smtp server is not relaying to the gmail server...you can check this using these steps
Take cmd prompt
1. c:> telnet smtp_servername 25
2. helo
3. mail from: [email protected]
4. rcpt to: [email protected]
5. data
test mail
.
Do the above steps one bye one
Hope this helps
Cheers,
Mohashar
visit www.mohamedashraf.tk
|
|
|
|
 |
Hello,
I m getting Initialization Block.......null exception while running program on eclipse version 3.2.......i read that there is suggestion of using weblogic.jar file....but i am working on tomcat. So, plz reply what should i have to do????????????????????
plz reply its very urgent.....
Gitanjali Dua
|
|
|
|
 |
It doesnot matter which web server you are using. It's a matter of mail api's are there in classpath. Pls check the required jars are in the classpath.
visit www.mohamedashraf.tk
|
|
|
|
 |
help please !!!!
Lghj
oojk;j
|
|
|
|
 |
Hello,
I m getting Initialization Block.......null exception while running program on eclipse version 3.2.......i read that there is suggestion of using weblogic.jar file....
but from where should i get it????
plz reply its very urgent.....
|
|
|
|
 |
Hi,
This is due to reference problem. You don't have appropriate jars then put weblogic.jar in the classpath and try it.
If you have weblogic you can get it from lib folder.
Rgs,
Ashraf Mohamed
visit www.mohamedashraf.tk
|
|
|
|
 |
here am getting these exception when am running the sendmail.java
Invalid address
i checked out classpath for jar files everything s correct
am using 1st smtp server downloaded frm web
i dont know y it is not working very urgent
plzzzzzzzzz reply me
|
|
|
|
 |
Hi,
Have you checked the smtp host name using telnet? Please check the smtp hostname is exist using following command
telnet smtpservername portnumber
If you still facing this problem send me the exception.
Hope ths helps.
Rgs
Mohashar
visit www.mohamedashraf.tk
|
|
|
|
 |
Hi,
I have implemented the same logic into my test program. Its working fine for the correct email addresses, but if I put email address as [email protected], then also its sending. though no reciept msg is coming even then no exception is there.
|
|
|
|
 |
Unless until you handle the bounce using pop3 it will not be showing any receipt of the message.
SMTP is not a point to point type protocol.It simply delivers it and bounced message must be captured by pop mechanisms.
Hope this helps...
visit www.mohamedashraf.tk
|
|
|
|
 |
Sending the mail i can set many attachments but the text of the mail is not displayed.
i mean the text like:
Subject: dinner
text:
where we meet?
if i add an attachment to the mail "where we meet" is not displayed.
but i f i don't attach nothing the text is showed.
|
|
|
|
 |
You meant to say, if you add an attachment you are not able to see the body right. Please check the attachment part overwrite the body content.
visit www.mohamedashraf.tk
|
|
|
|
 |
is how you told .. i was setting the body after all Attachment..
thanks for quick reply
|
|
|
|
 |
hi,
I got the following error if i run my code.
javax.mail.MessagingException: IOException while sending message;
nested exception is:
java.io.IOException: No content.
please help me.
|
|
|
|
 |
Hi,
Check all the jars are in classpath.
Rgs,
Asharaf Mohamed
visit www.mohamedashraf.tk
|
|
|
|
 |
hi,
I GOT javax.mail.MessagingException: IOException while sending message;
exception while running the code .
how to solve this problem.
thanq
|
|
|
|
 |
hi
thanks for replying me for the first que.u have developed it by using .net and xml isn't it.
now i want to modify it by using html/jsp and oracle (instead of .net and xml).Is it possible and i think it will be successful.
can u suggest me the betterway.
thank u........
Srilatha.A
|
|
|
|
 |
Hi,
You misunderstood. The above stated article I showed for your understanding. I have written two articles for one in C# and another one in java. First of all I could not understand your questions. If you want to use it jsp then put my code in init method.
Rgs,
Ashraf Mohamed
visit www.mohamedashraf.tk
|
|
|
|
 |
hi
U have mentioned in Brief Description like.........
"This article will help you to send mails using java API. I have given the basic java program. You can integrate this with any UI to make easy access."
in the above description what do u mean by UI?where can we use ur code? and how to implement the email page?what is the input page?can u explain it breifly...
thanking you.
srilatha a
|
|
|
|
 |
Hi Latha,
UI means user interface or GUI. You can use this java code how I used c# in Quick Mail.
http://www.codeproject.com/dotnet/quickmail.asp.
Hope this helps.
Rgs,
Ashraf Mohamed
visit www.mohamedashraf.tk
|
|
|
|
 |
Here i have given what i did
1.c:\>ProgramFiles>Java>Jdk1.5.0>bin>Jmail>set classpath=c:\mail.jar:c:\dnsjava.jar:c:\activation.jar;
javac MailTest.java
java MailTest
Now Also has the Same Error?
|
|
|
|
 |
To troubleshoot this, put weblogic.jar in classpath and try this and let me know the feedback.
Hope this helps..
visit www.mohamedashraf.tk
|
|
|
|
 |
Sir !
I put the files properly. But now it gives error
Initiallization Block-----null
i did not use weblogic and all.
Simple Java Only
What to do ?
[email protected]
|
|
|
|
 |
You should require jars in the classpath. Please check it again and let me know the feedback.
visit www.mohamedashraf.tk
|
|
|
|
 |
Sir !
I put the files properly. But now it gives error
Initiallization Block-----null
What to do ?
plz tell me immediatly.Bisweswar Sahu
mail immediatly --
[email protected]
Bisweswar Sahu
|
|
|
|
 |
Hi,
I think the problem with classpath. If you are using weblogic, put the weblogic.jar in classpath and try it.
Rgs,
Ashraf Mohamed
visit www.mohamedashraf.tk
|
|
|
|
 |
i had downloaded the zip file.
on compilation unable 2 import org.xbill.DNS.*;
plz say how 2 solve it?
plz give a step to run it.
I need it immediatly.
thank u !
Bisweswar Sahu.
|
|
|
|
 |
Dear sir,
I had first put all the jars at the right place and i had implemnted your source file: CommonMail.java and TestMail.java in eclipse. My smtp server is running well. when i run this code, i am getting a java.net.UnknownHostException exception at line: org.xbill.DNS.Record arecord[] = (new Lookup(smtphost, (short)15)).run(); because there is no element in the 'arecord'. it mean there is nothing in the lookup. i have also red your FAQ but unable to get the clue. please help me where i am wrong or is any setting is needed
layak
|
|
|
|
 |
Hi,
I am suspecting some jars are not in the classpath. Check the classpath before run the java program. If the classpath is ok, then check the smtphost. Send mail using telnet to verify the connectivity.
Rgs,
Ashraf Mohamed
visit www.mohamedashraf.tk
|
|
|
|
 |
thank you for your kind reply.
what have i done, here is the explaination.
I had downloaded your Java_Mail_demo.zip file and extracted it in the c:/ diretory and i had set the classpath of jars as(throught my comp>prop>envirn var) c:\mail.jar;c:\dnsjava.jar;c:\activation.jar
I run batchsendmail.bat,
there is know output. so i had tried another option through editor
next I have impotered CommonMail.java and MailTest.java
when i run it.
it is showing below problem
Mailing Process Started ............
java.lang.NullPointerException
Initialization Block.........null
Mailing Process Ended ............
at com.bkc.core.CommonMail.SendMail(CommonMail.java:27)
at com.bkc.core.MailTest.main(MailTest.java:14)
my SMTP is running well, i have tested through telnet by sending mail
Please give me some solution.
layak
|
|
|
|
 |
thank you for your kind reply.
what have i done, here is the explaination.
I had downloaded your Java_Mail_demo.zip file and extracted it in the c:/ diretory and i had set the classpath of jars as(throught my comp>prop>envirn var) c:\mail.jar;c:\dnsjava.jar;c:\activation.jar
I run batchsendmail.bat,
there is know output. so i had tried another option through editor
next I have impotered CommonMail.java and MailTest.java
when i run it.
it is showing below problem
Mailing Process Started ............
java.lang.NullPointerException
Initialization Block.........null
Mailing Process Ended ............
at com.bkc.core.CommonMail.SendMail(CommonMail.java:27)
at com.bkc.core.MailTest.main(MailTest.java:14)
my SMTP is running well, i have tested through telnet by sending mail
Please give me some solution.
Layak
|
|
|
|
 |
Hi Ashraf
I am really happy to get the zip file as this is the thing i eas looking for. But still there are few issues on which i need some confirmation from your side at the earliest, so it will be better if you can send a mail at [email protected].
1> The .sh file will call the MailTest.java file and it will in turn call the SendMail.java file. [correct me if i am wrong]
Now here in the MailTest.java file, for testing you have hardcoded the "text" for the mail but in my case I need to get the "text" from the database, so from the MailTest.java file can I call the database and get the text and then set it into the variable?
2> you have used 4 jar files, namely activation.jar,dnsjava.jar,mail.jar and sendmail.jar.
Can you please explian me the use of sendmail.jar., as it contains all the three other JARs,MailTest.java,SendMail.java and one .txt file.
3> In the SendMail.java file you have used one import statement :
import org.xbill.DNS.*;
can you please explain the use of this import?
I will be very grateful to you if you can clear my doubts ASAP.
Thanks & Regards,
Dipanjan Chatterjee
Software Engineer
BCMD, Infosys Technologies Ltd.
Bangalore.
Direct: 080-51174751 | Extn.- 54751
Cell: - +919886903523
|
|
|
|
 |
Hi,
Just now got the time to read my article status. Sorry for late reply.Anyway
1. You can get it from database/file.
2. If you want to use java mail api then sendmail.jar is must. I hope without this it will not work. I have red it many books. Please correct me if i am wrong. Please refer http://java.sun.com/products/javamail/FAQ.htm.
3. This is for finding the ipaddress from DNS name.
InetAddress ip = org.xbill.DNS.Address.getByName("localhost");
Best Regards,
Ashraf Mohamed
visit www.mohamedashraf.tk
|
|
|
|