4 Replies Latest reply on Oct 14, 2006 5:50 AM by mikezzz

    Unable to directly manipulate the FROM address in a Mail obj

    sappenin

      Hey All -- Looking for some simply feedback.

      Is there any good reason that the org.jboss.mail.message.Mail object does not expose the "from" field more publicly (or other fields for that matter)? As it stands now, the "from" field is private, so I can't manipulate it directly. Adding a header to the Mail object merely "appends" another From: header to the list of existing headers, which means there would be two FROM addresses (which I don't want).

      Does anyone have any input on exposing the FROM field on the Mail object via a public setter? My use case is below.


      USE CASE
      ------------
      I Create a user-account called "admin" in JBCS. Login to webmail, select the "admin" alias, and send a message from "admin" to a local user.

      In my Mail listener, the "FROM" address is "admin@localhost" because the MailAddress.parseSMTPStyle() function uses "localhost" as the default domain if no domain is detected.

      I want to be able to catch this in my mail-listener, and if necessary, "adjust" the FROM address to be "admin@example.com", or some other domain in my domain group.

      Using the public FROM setter, I merely update the FROM address, and process the Mail per usual --> the Mail object will be used to create a MessageData object, thus delivering the message to the intended recipient, with a proper TO address.