problem with !_NEWLINE_! ((InternetAddress)currentMessage.getFrom()[0]).getPersonal();
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   gurpreet_ahluwalia
Posted On:   Wednesday, April 24, 2002 04:25 AM

Actually i just want to extract the name of the sender from his/her address.... i tried ((InternetAddress)currentMessage.getFrom()[0]).getPersonal(); but this returns me "null"... i have also tried currentMessage().getFrom()[0].toString().. but no use... what i think there is some problem while i send the mail.. String from=user+"@"+host; msg.setFrom(new InternetAddress(from)); by doing this it always return null while trying to get Personal()... is there anything else does one has to put in while sending the mails so that the sender name can be extracted fro   More>>

Actually i just want to extract the name of the sender from his/her address....



i tried ((InternetAddress)currentMessage.getFrom()[0]).getPersonal();



but this returns me "null"...



i have also tried currentMessage().getFrom()[0].toString()..
but no use...



what i think there is some problem while i send the mail..



String from=user+"@"+host;



msg.setFrom(new InternetAddress(from));



by doing this it always return null while trying to get Personal()...



is there anything else does one has to put in while sending the mails so that the sender name can be extracted from the mail address


plz help me....

   <<Less

Re: problem with !_NEWLINE_! ((InternetAddress)currentMessage.getFrom()[0]).getPersonal();

Posted By:   Dieter_Wimberger  
Posted On:   Thursday, April 25, 2002 04:23 AM

What you are probably looking for is:
String from="Some Body ";

or
String from=personalname + "<" + user + "@" + host;


The API description for InternetAddress gives you the hint where to look for this kind of knowledge:
"This class models an RFC822 address."


A possible link where you can find that RFC is:
http://www.faqs.org/rfcs/rfc822.html

Good Luck,
Dieter
About | Sitemap | Contact