Aspose.Email Java - create outlook with sender account (send using account)

Hi,

I am using the Java Aspose.Email trial library to validate my use case with the product.

I am trying to create an Outlook email message, which is to be sent from a group mailbox in exchange.
When the user clicks the send button, the email should be saved to the "sent " folder of the group mail box.

What I do is the following:

1. create a MailMessage, where I set from to the mail address of the group mailbox “gmb@domain.be”
2. Create a MapiMessage fromMailMessage(mail message created in step1)
3. Save the MapiMessage to MSG file
4. Open the MSG file in outlook
5. Click send button
6. Validate “sent folder” of group mailbox and of personal mailbox.

The email is correctly sent using the from address=gmb@domain.be. However, the email is not saved to the “sent folder” of the group mailbox, but is saved to the “sent folder” of my personal mailbox.

When I open the MSG file in outlook, I can see (when hovering over the from address) that outlook mentions the following: “From:gmb@domain.be Send Using Account: personal.email@domain.com”. Please have a look at the attached word doc for screen shots.

When I manually create in outlook an email, and select the from address, I don’t see the “Send using account” mentioned. Instead it shows (when hovering over the from address) the from: “From:gmb@domain.be”.

Is it possible using the Aspose.Email java API to have the same behaviour?

I have tried to put some properties on the MapiMessage, but without success. I tried the following:
1/ outlookMsg.setStringPropertyValue( MapiPropertyTag.PR_SENT_REPRESENTING_EMAIL_ADDRESS, “GMB@domain.be”);
2/ outlookMsg.setStringPropertyValue( MapiPropertyTag.PR_SENT_REPRESENTING_NAME, “GMB@domain.be”);
3/ outlookMsg.setStringPropertyValue( MapiPropertyTag.PR_SENT_REPRESENTING_NAME, “!GMB1”);
4/ outlookMsg.setStringPropertyValue( MapiPropertyTag.PR_ACCOUNT, “GMB@domain.be”);

I have added the java code I’m using in the attached zip file.

Can you help ?

Thank you,
Best Regards,
Guy

Hi Guy,

Thank you for contacting Aspose support team.

I am working on this query and need further assistance to investigate it. I have tried to create the sample message using Outlook 2013 but could not observe the behavior mentioned below:

guy-dardenne:

When I open the MSG file in outlook, I can see (when hovering over the from address) that outlook mentions the following: "From:gmb@domain.be Send Using Account: personal.email@domain.com". Please have a look at the attached word doc for screen shots.

When I manually create in outlook an email, and select the from address, I don't see the "Send using account" mentioned. Instead it shows (when hovering over the from address) the from: "From:gmb@domain.be".

In my case I get "From:gmb@domain.be Send Using Account: personal.email@domain.com". in both cases i.e. message generated by AE and message generated by Outlook.

Could you please send us the steps how you created the message using Outlook, whose snapshot is given in the attached word doc? It will help us to create the sample message here for analysis and provide solution as soon as possible.
Hi Kashif,

Thank you for your feedback.

[quote user="kashif.iqbal"]
In my case I get "From:gmb@domain.be Send Using Account: personal.email@domain.com". in both cases i.e. message generated by AE and message generated by Outlook.

Could you please send us the steps how you created the message using Outlook, whose snapshot is given in the attached word doc? It will help us to create the sample message here for analysis and provide solution as soon as possible.
[/quote]

To be able to reproduce this correctly you must have 2 mail accounts (exchange email accounts!) defined in your Outlook profile.
I suppose currently you have 1 mail account specified in Outlook, I suppose it is your personal mailbox: yourfirstname.yourlastname@domain.com.
You should add a second mail account (exchange email account) to your outlook profile: gmb@domain.com.
It should represent the account from which the email will be sent (gmb@domain.com).

Add this account to Outlook as follows:
  1. Go to "Start menu -> Settings -> Control panel -> Mail"
  2. Click on Email accounts.
  3. On the tab "E-mail" click New account.
  4. Select "E-mail account" (remark: if this automatic config doesn't work, you should use the "Manually configure server settings or additional server types").
  5. Type the name (GMB) and email address (gmb&domain.com).
  6. Click next => the email account is added to your profile.
  7. Restart outlook.

Now to create the message using outlook do the following.
  1. Click New Email.
  2. Click on the "From" dropdownbox to select the account you have added (instead of your personal email account).
  3. Send a message to any recipient.
  4. Go to the "Gmb@domain.com" account, and open the sent-items folder.
  5. You should find the sent email in the sent folder of the "gmb@domain.com" instead of in your personal account's sent items folder.

Hope you can now reproduce both test cases.

Looking forward to your feedback.
Best regards,
Guy




Hi Guy,

We are sorry for a delayed response. I would request you to please spare us a little more time in this regard as we are working over this query and will soon share our findings with you here.

Hi Kashif,

Were you able to reproduce the issue?
Did you find a solution or workaround?

Looking forward to your response.
Br,
Guy

Hi Guy,

Thank you for sharing your concern with us.

I was able to reproduce this issue at my end using the latest version of Aspose.Email for .NET 4.6.0 and have logged it as NETWORKNET-34524 in our issue tracking system for further investigation by our development team. Once there is any information available in this regard, I'll update you here via this thread.

We are sorry for the inconvenience caused to you.

Hi,

Any update on this issue NETWORKNET-34524 ?

Thx,
Guy

Hi Guy,


The issue has been investigated and we found it not to be a problem with the API. For example, we may see the same behavior in following cases:

Situation A:

1. Press Create message in outlook (do not save it)
2. Fill the fields.
3. Press File->Save As and save it on disk
4. Press Esc to close the message
5. When you will see message box with question about saving changes, you have to press NO. (in this case message doesn’t save in pst file). So you will have only message on hard drive.
6. Then when message is closed, you may open message from hard drive (double click it).
7. Try to send it. Result will be the same like with Aspose.Email.

Situation B:

1. Open notepad and create file message.eml
2. Fill it with following text

From: secondary@domain.com
To: remotefriend@domain.com
Subject: Message saved in wrong mailbox sent folder after sending
X-Unsent: 1
MIME-Version: 1.0

This is a test message, please ignore it.

3. Save and close it
4, Open message from hard drive (double click it).
7. Try to send it. Result will be the same like with Aspose.Email.

Hi Muhammad,

Situation A does actually work. If you create a new email in Outlook and you change the ‘From’ to a different mailbox and fill in something in the subject (Very important! Otherwise the ‘From’ is not persisted…), save it to the harddrive, open it, specify a recipient and send it then it gets indeed saved in the ‘Sent’-folder of the mailbox you assigned it to.

We currently use that as a workaround eg load a MSG-file in which the ‘From’ is already correctly set and go from there.

Hi Guy,


We are further investigating this issue at our end and shall share our feedback with you here.