Hello, 

I'm developing a small functionality in my app which allows a user to send 
email to given reciepient.
Every sent email is stored in a repository containing information about the 
sender, recipient, send date, *delivery status*, etc.
I'm having my own Email Entity class used to represent the above 
information.

I'm using the *Low-Level 
API*<https://developers.google.com/appengine/docs/java/javadoc/com/google/appengine/api/mail/package-summary>
 to 
send email messages and the 
*BounceNotificationServlet*<https://developers.google.com/appengine/docs/java/mail/bounce>which
 is used to receive notification when an email is not delivered 
successfully.

For security reasons GAE provides only a small set of headers that an 
outgoing email can have (*Sending email with 
headers*<https://developers.google.com/appengine/docs/java/mail/#Java_Sending_mail_with_headers>
)

So when I'm sending an email message first I compose my Email entity 
object, save it in the datastore and from there I'm building the actual 
Message<https://developers.google.com/appengine/docs/java/javadoc/com/google/appengine/api/mail/MailService.Message>
 that 
will be send.
I'm using the "Reference" header and I'm writing the unique Email entity 
id. I need this so when I receive a notification that en email was not 
deliveired,
I can load the email (using the written email id in the headers) from the 
datastore and update it's status

I manage to set the header for the outgoing message, and when the 
BounceNotificationServlet from the request I'm getting the 
BounceNotification<https://developers.google.com/appengine/docs/java/javadoc/com/google/appengine/api/mail/BounceNotification>
 which 
contains info about the status of the message. 
>From there I can get the actual MimeMessage that was sent. I've expect all 
of the headers but the one that I set ("Reference") was not included.

Because of that I'm having a workaround. In the content of the email 
message I'm appending the email id, after that when the 
BounceNotificationServlet is invoked
I'm parsing the content of the MimeMessage, retrieve the email id and etc. 
It's a lot of work and the code is not looking good.

Also I've tried the 
JavaMail<https://developers.google.com/appengine/docs/java/mail/usingjavamail> 
which 
allows to the Transport object (responsible for sending email messages) to 
add a listener which is invoked when a message is delivered, not delivered. 
But when I deployed my application in GAE I've received 
AccessDeniedException.

My question is this the correct way for using headers and setting an unique 
id for every sent email ? 

Thank you for your help

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to