Discussion:
Unique ID for SMTP messages
scorpion10
2008-09-15 16:39:39 UTC
Permalink
I am trying to send SMTP messages (Using JavaMail API v 1.4). Since I need
high performance I make use of Threads to submit messages (I submit around
100 messages per second). My question is how would I know when the response
arrives, to which request it was. In other words is there any field called
ID which I can set in the request and get it back in the TransportEvent?

One of the way I can see is to set as Header value and retrieve it from the
TransportEvent. But then the problem is the recipient of the message can get
this value too (Which is not desirable).

So please let me know if there is any way I can set the ID.

Thanks
--
View this message in context: http://www.nabble.com/Unique-ID-for-SMTP-messages-tp19496641p19496641.html
Sent from the Javamail mailing list archive at Nabble.com.

===========================================================================
To unsubscribe, send email to ***@java.sun.com and include in the body
of the message "signoff JAVAMAIL-INTEREST". For general help, send email to
***@java.sun.com and include in the body of the message "help".
Bill Shannon
2008-09-15 17:35:37 UTC
Permalink
Post by scorpion10
I am trying to send SMTP messages (Using JavaMail API v 1.4). Since I need
high performance I make use of Threads to submit messages (I submit around
100 messages per second). My question is how would I know when the response
arrives, to which request it was. In other words is there any field called
ID which I can set in the request and get it back in the TransportEvent?
One of the way I can see is to set as Header value and retrieve it from the
TransportEvent. But then the problem is the recipient of the message can get
this value too (Which is not desirable).
So please let me know if there is any way I can set the ID.
If all you're looking for is the confirmation that the server has
received the message (which is all the TransportEvent is telling you),
it's probably easy just to not listen for the transport events and
simply use the success of the send method.

===========================================================================
To unsubscribe, send email to ***@java.sun.com and include in the body
of the message "signoff JAVAMAIL-INTEREST". For general help, send email to
***@java.sun.com and include in the body of the message "help".
scorpion10
2008-09-15 18:37:48 UTC
Permalink
Yes you are right but I store the request event (which I use later when I get
the response) into a queue. The request event is my own event where I have
some other processing to do. So I need this unique ID for retrieving this
event from the queue when I get the TransportEvent.

So I feel its better to give a ID parameter for storing some unique ID.
(Just a suggestion).

Right now for this I found a way i.e. I create a hashCode for the Object and
store this value as a uniqueID.

Thanks
Post by Bill Shannon
Post by scorpion10
I am trying to send SMTP messages (Using JavaMail API v 1.4). Since I need
high performance I make use of Threads to submit messages (I submit around
100 messages per second). My question is how would I know when the response
arrives, to which request it was. In other words is there any field called
ID which I can set in the request and get it back in the TransportEvent?
One of the way I can see is to set as Header value and retrieve it from the
TransportEvent. But then the problem is the recipient of the message can get
this value too (Which is not desirable).
So please let me know if there is any way I can set the ID.
If all you're looking for is the confirmation that the server has
received the message (which is all the TransportEvent is telling you),
it's probably easy just to not listen for the transport events and
simply use the success of the send method.
===========================================================================
of the message "signoff JAVAMAIL-INTEREST". For general help, send email to
--
View this message in context: http://www.nabble.com/Unique-ID-for-SMTP-messages-tp19496641p19498586.html
Sent from the Javamail mailing list archive at Nabble.com.

===========================================================================
To unsubscribe, send email to ***@java.sun.com and include in the body
of the message "signoff JAVAMAIL-INTEREST". For general help, send email to
***@java.sun.com and include in the body of the message "help".
Bill Shannon
2008-09-15 19:21:36 UTC
Permalink
Post by scorpion10
Yes you are right but I store the request event (which I use later when I get
the response) into a queue. The request event is my own event where I have
some other processing to do. So I need this unique ID for retrieving this
event from the queue when I get the TransportEvent.
So I feel its better to give a ID parameter for storing some unique ID.
(Just a suggestion).
Right now for this I found a way i.e. I create a hashCode for the Object and
store this value as a uniqueID.
What information do you need in the queue? Just create your own object to
hold that information, possibly including the MimeMessage object that you
sent. Put the information in the queue after you call Transport.send.

Note also that JavaMail will generate a Message-ID header for each message.
That might meet your needs for a unique ID. You can fetch that from the
Message object included in the TransportEvent, if you really want to use
TransportEvent.

===========================================================================
To unsubscribe, send email to ***@java.sun.com and include in the body
of the message "signoff JAVAMAIL-INTEREST". For general help, send email to
***@java.sun.com and include in the body of the message "help".
Loading...