I believe I might have found something to do this.
First Solution
Properties prop = new Properties();
props.put("mail.smtp.dsn.notify", "SUCCESS,FAILURE,DELAY
ORCPT=rfc822;[EMAIL PROTECTED]");
props.put("mail.smtp.dsn.ret", "FULL envid=123");
msg.setHeader("Return-Receipt-To", "[EMAIL PROTECTED]");
Session session=Session.getInstance (props,null);
I don't really like the look of this method. I don't really want to be changing my
session around if I want to send out multiple mails using the same session.
Second Solution
Use SMTPMessage
This class extends MimeMessage, so I think I can use this all the time ( I don't plan
at the moment to be using anything other than SMTP mail )
The setNotifyOptions(int options) method of this class is where my attention is
directed.
These are the notify fields of this class
NOTIFY_SUCCESS
NOTIFY_NEVER
NOTIFY_FAILURE
NOTIFY_DELAY
This is the desription of the method
setNotifyOptions
public void setNotifyOptions(int options)
Set notification options to be used if the server supports Delivery Status
Notification (RFC 1891). Either NOTIFY_NEVER or some combination of NOTIFY_SUCCESS,
NOTIFY_FAILURE, and NOTIFY_DELAY.
If set, overrides the mail.smtp.dsn.notify property.
Parameters:
options - notification options
Question: How would I include a combination of the notify fields? Would I add them
together? or would I use a | operator?
-----Original Message-----
From: Luc Foisy
Sent: Friday, May 24, 2002 9:08 AM
To: JDJList
Subject: [jdjlist] Re: JavaMail
Similar to "Disposition-Notification-To" where it will send a message to the email
supplied when the recipient reads the mail.
But I would also like to know when the message has been delivered. I assume this is
picked up by the mail server from the header and it will send the notification. I know
it exists, I just do not know what it is. ( It is available in Outlook at least )
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 23, 2002 10:20 PM
To: JDJList
Subject: [jdjlist] Re: JavaMail
Please elaborate what you wanna do in details...say, what you want the field
"Delivery Request" to do for u?
>From : "Luc Foisy" <[EMAIL PROTECTED]> on 23/05/2002 05:16:45 PM
To: [EMAIL PROTECTED]
cc: (bcc: Victor HT CHEUNG/HD/HKSARG)
Subject: [jdjlist] Re: JavaMail
Excellent. This works! An email is returned to the address specified when the
recipient reads the mail.
Now, would you happen to know the "Delivery Request" field to add to the
header?
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 21, 2002 9:51 PM
To: JDJList
Subject: [jdjlist] Re: JavaMail
Greetings,
I am not sure whether JavaMail API provides a specific method for doing that or
not.
But, I think you can archive what you want by doing the following things.
Basically many of those similar functions provided by the internet protocol are
used some optional header fields.
For instance, if you are familiar with HTTP protocol, you should know
"Set-cookie: " headers are used for delivery of additional information.
In a mail message, we can add the following header field to indicate the a
"return receipt" is required for the message.
Disposition-Notification-To: yourname <[EMAIL PROTECTED]>
The read receipt mail would be sent to the address you set.
In JavaMail, you can invoke addHeader(String, String) of the
javax.mail.internet.MimeMessage instance to add the above header to your
message.
e.g.
...
// create a message
Message msg = new MimeMessage(session);
// add header
msg.addHeader("Disposition-Notification-To", "yourname <[EMAIL PROTECTED]>
");
...
(I didn't test the code above, hope it works)
Happy Programming
-Victor Cheung
>From : Luc Foisy <[EMAIL PROTECTED]> on 21/05/2002 12:27:14 PM
To: [EMAIL PROTECTED]
cc: (bcc: Victor HT CHEUNG/HD/HKSARG)
Subject: [jdjlist] JavaMail
Could anyone tell me if JavaMail has some kind of support for mail tracking?
As in, tagging the mail to send a reply when the message is sent, and when
the message is read?
I think its called "read reciept" or something. I can't find anything in the
API or in a few tutorials about it.
Can you do this, and how do you do it? ( any tutorial pointers would be good
)
Luc Foisy
To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm
To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm
To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm
To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm
To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm
To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm