I'm working with javax.mail.*. I have no problem with reading in messages.
I'm not using multi-part messages or anything, I just use this setup:
Session oSession = Session.getDefa ultInstance(pro ps, null);
try {
oStore = oSession.getSto re("pop3");
oStore.connect( sInServer, sInName, sInPass);
oFolder = oStore.getFolde r("INBOX");
oFolder.open(Fo lder.READ_WRITE );
oMessage = oFolder.getMess ages();
if (oMessage.lengt h == 0) {return;}}
} catch (Exception e)
{System.out.pri ntln("Problem with opening and getting messages: " + e);}
for (int i=0, n = oMessage.length ; i < n; i++) {
try {
System.out.prin tln(i + ": " + oMessage[i].getFrom()[0] + "\t"
+oMessage[i].getSubject());
} catch (Exception e)
{System.out.pri ntln("Problem printing message info: " + e);}
try {sContent = (String) oMessage[i].getContent();} catch (Exception e)
{System.out.pri ntln("Problem getting message content: " + e);}
//From here, do stuff with the message -- like saving the content
}
The code is still new, so I'll be using actual error handlers.
Here's the problem: There are times when I want to save a copy of the ENTIRE
message, including the headers, so I can use the headers later (possible
spam filtering and other stuff).
I've found the getHeader() and similar functions in Java Mail that return
headers as objects. Isn't there some SIMPLE and quick way to get a string
that contains all the headers? Like a "Header" version of getContent()?
I basically just want to dump the header and content to the drive. I
thought I read somewhere that there was a call to use to get the full
header and content together, but I haven't been able to re-locate it or
verify it's what I read.
Thanks for any help!
Hal 0 2214 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: pee2pee |
last post by:
Hi,
I have below code:
<html>
<head>
<title>Contacting Worldpay, Please wait.......</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body text="#CCCCCC">
|
by: James Hong |
last post by:
Help please, I try to sending an email from my html page using the java
applet.
but it give error on most of the PC only very few work, what is the error i
make
the java applet show as below
**********************************
package Celcom.Client;
|
by: Nick Chorley |
last post by:
Lo all,
I've written a simple program that connects to a POP3 server, allows me
to authenticate and then retrieves a certain message. The problem I'm
having is that when it retrives the message and prints it to the
console, I get different results depending on if I use a while loop or a
do-while loop. When I use a while loop, I get some of the headers but no
message body. When I use a do-while loop, I get some of the same
different...
|
by: baustin75 |
last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie
only when debugging in php designer 2005
--------------------------------------------------------------------------------
Hello,
I have a very simple problem but cannot seem to figure it out. I have a
very simple php script that sends a test email to myself. When I debug
it in PHP designer, it works with no problems, I get the test email. If
|
by: Sai Kit Tong |
last post by:
I posted for help on legacy code interface 2 days ago. Probably I didn't
make it clear in my original mail. I got a couple of answers but none of
them address my issues directly (See attached response). My first reply
directed me to source code migration but I didn't have the source code. The
second reply mentioned about .NET interoperability (PInvoke I think) but I
MENTIONED THAT I COULDN'T FIND ANY DOCUMENTATION FROM MSDN LIBRARY BASED ON...
| |
by: David Van D |
last post by:
Hi there,
A few weeks until I begin my journey towards a degree in Computer
Science at Canterbury University in New Zealand,
Anyway the course tutors are going to be teaching us JAVA wth bluej and
I was wondering if anyone here would be able to give me some tips for
young players such as myself, for learning the language.
Is this the best Newsgroup for support with JAVA?
|
by: e_matthes |
last post by:
Hello everyone,
I am trying to use the mail() function to send a simple, text-only
message. I have two websites hosted by the same company, on different
servers. One is old and established, one I am currently developing.
I am testing the mail functionality by sending a test message to an
email account associated with my old website, and to my hotmail
account. The message seems to be sent to both accounts, and I receive
the message on...
|
by: crazycooter |
last post by:
I found an old thread on this (http://groups.google.com/group/alt.php/
browse_thread/thread/751edb9c723316c4/ea9bf92a9c6b807c?lnk=gst&q=mail()
+duplicate&rnum=7#ea9bf92a9c6b807c), but there didnt seem to be a
resolution. I also noticed that this was a pretty old thread and there
didn't seem to be anything newer in the search results.
Regardless, I have a very similar problem; I am consistently getting
five emails per each PHP mail()...
|
by: Gordon |
last post by:
I'm working on a reset password script for my CMS, that will generate
a random password and email it to a user when they request one. The
problem I am having is that the mails being sent out are beign marked
as spam by our internal mail system and never reaching users'
inboxes. I've also discovered that Yahoo Mail considers these mails
to be spam, but it moves them to the spam folder instead of just
dropping them.
I wrote a simple...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |