Always get the InternetAddress & javax.mail.Session error
<%@ page import="javax.mail.*" %>
<%@ page import="javax.mail.internet.*" %>
<%@ page import="javax.activation.*" %>
<%@ page import="java.util.*,java.io.*" %>
<%@ page contentType="text/html;charset=big5" %>
<html>
<head>
<title>JavaMail</title>
</head>
<body>
<h2>利用JavaMail來傳送電子郵件 - 附加檔案</h2>
<%
InternetAddress[] address = null;
request.setCharacterEncoding("big5");
// MultipartRequest multi = new MultipartRequest(request , "." , 5*1024*1024 , "big5");
String mailserver = "mail.dwu.edu.tw";
String From = request.getParameter("From");
String to = request.getParameter("To");
String Subject = request.getParameter("Subject");
String type = request.getParameter("Type");
String messageText = request.getParameter("Message");
String FileName = request.getParameter("FileName");
boolean sessionDebug = false;
try {
// 設定所要用的Mail 伺服器和所使用的傳送協定
java.util.Properties props = System.getProperties();
props.put("mail.host",mailserver);
props.put("mail.transport.protocol","smtp");
// 產生新的Session 服務
javax.mail.Session mailSession = javax.mail.Session.getDefaultInstance(props,null);
mailSession.setDebug(sessionDebug);
Message msg = new MimeMessage(mailSession);
// 設定傳送郵件的發信人
msg.setFrom(new InternetAddress(From));
// 設定傳送郵件至收信人的信箱
address = InternetAddress.parse(to,false);
msg.setRecipients(Message.RecipientType.TO, address);
// 設定信中的主題
msg.setSubject(Subject);
// 設定送信的時間
msg.setSentDate(new Date());
if (FileName != null)
File file = new File(FileName);
// 如果有附加檔案時,先將郵件內容部份先存起來
MimeBodyPart mbp1 = new MimeBodyPart();
// 設定郵件內容的型態為 text/plain 或 text/html
mbp1.setContent(messageText, type + ";charset=big5");
// 再來對檔案作處理
MimeBodyPart mbp2 = new MimeBodyPart();
FileDataSource fds = new FileDataSource(FileName);
mbp2.setDataHandler(new DataHandler(fds));
mbp2.setFileName(MimeUtility.encodeText(fds.getName(), "big5", "B"));
// 最後再將二者整合起來,當作一份郵件送出
Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp1);
mp.addBodyPart(mbp2);
msg.setContent(mp);
else
// 若沒有檔案時,就直接存郵件內容
msg.setContent(messageText,type + ";charset=big5");
Transport.send(msg);
out.println("郵件己順利傳送");
catch (MessagingException mex)
mex.printStackTrace();
%>
</body>
</html>
==================================
i don't know why i always get the error about the type even i already add the jar file in lib folder:
InternetAddress cannot be resolved to a type
javax.mail.Session cannot be resolved to a type
What server are you using?
Did you follow the instructions on the JavaMail FAQ for setting up the server?
Did you restart the server?
Similar Messages
-
Change the Mail-Session's type in glassfish to type javax.mail.Session
hi all guys!
com.sun.enterprise.deployment.MailConfiguration is the default type of Mail_Session in the glassfish, but I want the javax.mail.Session to construct a MimeMessage!
How can I do?
All comments will be appriciate!It sounds like you are attempting to lookup the resource using the non-portable server dependent resource name (and you are getting a non-portable server dependent result in return).
If instead, you use the portable JNDI name of the mail resource, the expected javax.mail.Session object will be returned, e.g.
Session mailSession = (Session) ic= new InitialContext().lookup("java:comp/env/mail/mobileMailSession");
Also make sure that the resource has been assigned the JNDI name you decide on ("mail/mobileMailSession" in the example above).
See also https://glassfish.dev.java.net/issues/show_bug.cgi?id=4500 and http://forum.java.sun.com/thread.jspa?threadID=5277688&tstart=75 for more information and context. -
Authorization error for referenced class javax/mail/Session.
All,
I am trying to compile a java source which is using session object in javax/mail/session.
I am getting the error java/lang/System: Authorization error for referenced class javax/mail/Session.
I used "import javax.mail.*;" in my java source..
I loaded both mail.jar and activation.jar using the below command in different schema other than the schema which above java source exists.
loadjava -thin -verbose -user <user>/<pwd>@<dburl> -resolve -synonym activation.jar
loadjava -thin -verbose -user <user>/<pwd>@<dburl> -resolve -synonym mail.jar
After loading, All java classes in mail.jar and activation.jar were in compiled state in that schema
Its working well in different database having the same configuration.
My oracle version is Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit ProductionI have to accomplish tried in CONSOLE TestMail.class:
C>java TestMail
Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/Partmy make.bat:
javac -g -classpath
...\Java\jre1.5.0_06\lib\activation.jar;...\jre1.5.0_06\lib\imap.jar;...\jre1.5.0_06\lib\mail.jar;...\jre1.5.0_06\lib\mailapi.jar;...\jre1.5.0_0\lib\plugin.jar;...\jre1.5.0_06\lib\pop3.jar;...\jre1.5.0_06\lib\smtp.jar;...\jre1.5.0_06\lib\javamail-1_3_2-src-jrl.zip;...\jre1.5.0_06\lib\j2ee.jar TestMail.javaWhat isn't correct?
Tanks,
Mohammad -
I try to export my Imovie and I always get the error code"Unable to prepare project for publishing...File already open with write permission" it even does it when I am just trying to export to my external hard drive to save the file
Thanks!!! I had same error (with -49) and the mac had an external hard drive attached.. and it was doing a backup. Stopped, disconnected and the project exported!
-
I am trying to listen BBC radio news from BBC App, but on pressing the button "live radio" I always get the error "there was an error playing this radio feed". What is the source of this error and how can I remove it?
That is probably just a generic error message and you might not ever know what is causing it. Assuming that you have been able to play live radio with the app in the past (I know nothing about the app) and assuming that all other Internet related functions (Safari, email, etc.) are working properly on your iPad, quit the app completely and reboot your iPad.
Go to the home screen first by tapping the home button. Double tap the home button and the recents tray will appear with all of your recent apps displayed at the bottom. Tap and hold down on any app icon until it begins to wiggle. Tap the minus sign in the upper left corner of the app that you want to close. Tap the home button or anywhere above the task bar.
Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider if it appears on the screen - let go of the buttons. Let the iPad start up.
If that fails to resolve the issue, you might want to reboot your router, unplug it for about 30 seconds and then plug it in again. -
I cannot get Elements 13.1 to download completely. I have 3 different case numbers from Adobe and nothing helps. I always get the "download failed" and the error code u44m1i210. I would either like to get the product downloaded or eliminate the constant attempt which just ties up my computer.
You could try the direct download links here
Adobe Photoshop Elements 13 Direct Download Links, Premiere too | ProDesignTools
And here is some info on that error code
Error U44M1I210 | Install updates -
How come, when I add myYahoo! email account to MAIL, after verifying, I always get the "server unavailable. please try again later"
THANKS! this worked !!!
I hit "DELETE THIS ACCOUNT" on my iphone (this is the Yahoo I tried to set up by "picking" it from the list that the iphone5 gives you) and then confirmed to delete everything.
THEN: while in Mail (still in the Settings Section) I tapped on "ADD ACCOUNT..." but this time tapped on "OTHER" and manually put in my yahoo ID and password and I did not even have to go to the SMTP or IMAP incomming/outgoing stuff at all. But I checked it out under the "ADVANCE" tab and it was already correct for yahoo. (ALMOST SEEMED TOO EASY)
Went to my home screen and tapped on MAIL and my yahoo email loaded up just right!
Now, I have no idea if I have any other issues like if I delete mail on the iphone; does it delete properly on my ipad...etc..etc. but one problem at a time is getting fixed. THANKS! -
i get the message lightroom V5.5 is availeble, i downloaded it, but i always get the error, lightroon.msi is missing, fault 1714, can not uninstall V5.5 ( and i just want to install that ??? )
Lightroom 4.2 Installation Issue
-
I have an older Macbook with OS/X. Tried to download iTunes 10 a few times now, but when installing I always get the same error message: Run Preinstall Script for Apple Mobile Device Support. What can I do to finalise the installation?
Thanks. Short of the sort of "generic" suggestions of restaring your system, if you haven't, and repairing disk permissions and verifying the disk, I don't have any advice right now. I'll do some research and see if I can come across anything. Meanwhile, someone else may have an idea.
Regards. -
Best I have been trying for a week to order greeting cards using iPhoto but do I always get the same statement:
there has been an error occurred while connecting to Apple's online store try againBest I have been trying for a week to order greeting cards using iPhoto but do I always get the same statement:
there has been an error occurred while connecting to Apple's online store try again -
Why I always get the error(ORA-00600)?
Why I always get the error(ORA-00600)?
My database Oracle 9.2.0.1.0 I installed Oracle Jdeveloper 9i on my computer.
OS:windows2000
My program:
Class.forName("oracle.jdbc.driver.OracleDriver");
con =java.sql.DriverManager.getConnection("jdbc:oracle:thin:@server:1521:db","developer","12345");
java.sql.Statement stmt=con.createStatement();
java.sql.ResultSet rs=stmt.executeQuery("select task_title from task");
while (rs.next()){
//getInformation
String fjbh=rs.getString("task_title");
If I use this in a common java program(like MyParser.java). It will work well:
D:\JavaApp> java MyParser
but If I put the code into a JSP file . It will not work.I tried several times.
I find that the statment:
java.sql.ResultSet rs=stmt.executeQuery("select task_title from task");
will throw the exception.It seemd that I can connect to the database ,
but can not execute some sql statment.
If I execute this sql statment:
select sysdate from dual ;
or
select task_ID from task ; --task_id is a column with the type NUMBER(10)
it will work.
but if I execute :
select Task_Title from task where task_id=1; --Task_Title is a column with the type VARCHAR(50)
or
select t.task_text.getCLOBVal() task_Text from task t where task_ID=1;
--task_text is a column with the type XMLTYPE, I use this column save XMLFile.
it will not work.
the detail error information as follow:
java.sql.SQLException: ORA-00600: internal error code, arguments: [ttcgcshnd-1], [0], [], []It is a database bug (an ORA-0600 almost always is). In this case it is bug# 1725012. You can see the details from MetaLink. There are some patches (by platform) available you should see which may apply to you.
-
I am always getting the message ' could not complete due to program error" Why does this happen
I am always getting the message ' could not complete due to program error" Why does this happen
Without knowing a lot more details we can't tell you anything. This is just the most generic Photoshop error message imaginable. What system are you on? What version of Photoshop? what are you doing when the error occurs? Provide as much info as you can. Refer to this as a start:
Working with your Operating System’s Tools
Mylenium -
I wanted editing a photo from lightroom to elements but lightroom did not open elements. Your site said first to reinstall Elements before to try more comlicated things. It is the worst thing I ever done. Now i have lost Elements at all. It does not want to reinstall. Very funny. I tried all Adobe (!!!) suggestions: change OOBE for OOBE.bak; copy file from the dvd to computer before autorun executable,etc etc NOTHING WORKS !
Adobe suggested to download ASA program but only to tell us that it does more exist !!! After that they suggested to try to find MANUALLY the dailies failure reports !!! It is impossible to understand those reports
Thank for your help!!HI,
Win7-64, Lightroom 4.4 Photoshop Elements 11 GPU Nvidia Quadro K600, 4g RAM, Dell U2713H , all servicepack updated.
After several hours searching on the web Finally found that in c\programfiles(x86)\commonfiles\adobe\OOBE
Rename in OLDOOBE
Stop antivirus
Restart windows
Copy directory of the DVD Adobe PSE 11 to c\ ord\:nameit ADOBE\
Open file
Click right to setup.exe
Buzinga.
It is the worst software I ever had to deal whit.
FargateOne
De : Mylenium
Envoyé : 7 mai 2014 10:26
À : Pascal Renauld
Objet : How to reinstall Elements 11 when you always get the message: error sharedtechnolgies failed.
How to reinstall Elements 11 when you always get the message: error sharedtechnolgies failed.
created by Mylenium <https://forums.adobe.com/people/Mylenium> in Photoshop General Discussion - View the full discussion <https://forums.adobe.com/message/6361905#6361905> -
I don't think additional details will help since I don't have any. I have tried repeatedly to install this update and always get the same result which I have already detailed. This is technically an Add-On but I was given no place to ask questions about it.
See if this helps you. <br />
https://support.mozilla.com/en-US/kb/unable+to+install+add-ons#Download_Error_228 -
Unable to lookup javax.mail.Session in JNDI lookup
Hi,
We are getting java.io.NotSerializable exception when trying to lookup javax.mail.Session
in JNDI lookup.
The code is as follows:
try {
Hashtable ht = new Hashtable();
ht.put(Context.PROVIDER_URL, "t3://localhost:localport");
ht.put (Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
Context ctx = new InitialContext(ht);
try {
Object obj = ctx.lookup("jndiname_of_Mailsession");
session = (Session)javax.rmi.PortableRemoteObject.narrow(obj, Session.class);
} catch (Exception ex1) {
ex1.printStackTrace();
The exception stacktrace is as follows:
javax.naming.ConfigurationException. Root exception is java.rmi.MarshalException:
error marshalling return; nested exception is:
java.io.NotSerializableException: javax.mail.Session
java.io.NotSerializableException: javax.mail.Session
We are using Weblogic 6.0 SP2.
Any clue will be helpful to us.
Thanks.Hello Sumit
You've got this exception because javax.mail.Session is not serializable. It
does not depend on whatever implementation you use. In fact you can only use
the mail session you set up when you are in the server. I mean, when you try
to use it from an EJB, http bean session or whatever code that runs in the
weblogic server. Weblogic does not give a Serialized copy of the session to
the client but directly a reference on the only one Session created at boot
time, even if you lookup for it.
In your exemple, you try to get a reference on a Session from a client
program. It cannot work ! Session is not Serializable.
Hope this help
dom
"Sumit " <[email protected]> a écrit dans le message news:
3b3ac101$[email protected]..
>
Hi,
We are getting java.io.NotSerializable exception when trying to lookupjavax.mail.Session
in JNDI lookup.
The code is as follows:
try {
Hashtable ht = new Hashtable();
ht.put(Context.PROVIDER_URL, "t3://localhost:localport");
ht.put (Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
Context ctx = new InitialContext(ht);
try {
Object obj = ctx.lookup("jndiname_of_Mailsession");
session = (Session)javax.rmi.PortableRemoteObject.narrow(obj,Session.class);
} catch (Exception ex1) {
ex1.printStackTrace();
The exception stacktrace is as follows:
javax.naming.ConfigurationException. Root exception isjava.rmi.MarshalException:
error marshalling return; nested exception is:
java.io.NotSerializableException: javax.mail.Session
java.io.NotSerializableException: javax.mail.Session
We are using Weblogic 6.0 SP2.
Any clue will be helpful to us.
Thanks.
Maybe you are looking for
-
Itunes won't open - possible virus - how can I backup before OS reinstall
My itunes program, along with my internet connection, Outlook, and several other system programs, is not working. One day the computer just wouldn't let me open this set of programs, and since I can't go online I can't download the itunes program aga
-
Just wondering how you import your gmail account so that you can use it with the mail on the bottom task bar. Thanks, Mel
-
Need some advice - Newbie starting an advertising business..
Hello, I am new to Indesign, having used quark previously. Basically i print and publish an advertisment magazine. I create these advertisements from scratch or in some cases from logos i am sent by the clients via email. I need to understand whether
-
Please could someone tell me what is it I am doing wrong. have been trying to display jsp data in a Flex datagrid. I have not been successful. My code is submitted below: Thank You Jonas My Flex Code ==================================
-
Reg: outbound file for Autolock box
Hi Consultants, we have requiremnet to send back a file to bank with unapplied and unidentifed payments. bank is providing the data filed sequence nuber for each payment records as 1,2,3... this data we are populating the item_number column in the ap