Click here to Skip to main content
15,669,133 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a web application that sends significant volumes of emails, using SMTP. The SMTP server is Office365.com and this is storing copies of sent emails in the SENT folder when viewed in Outlook.office365.com

I can periodically using the web interface to delete out sent emails older than 3, 6 or 12 months (or all) but this will always risk the total mailbox size exceeding limits (as happened today). Outlook "rules" don't apply to the sent folder, and only built-in retention policies can be applied to that folder; so I can't setup a "delete after 1 day" policy and apply it.

Is there any way I can configure things, either via the web interface OR via the SMTP send itself, to prevent messages sent by SMTP being saved in the SENT folder?

What I have tried:

* Set up a custom retention policy, but these can't be applied to the SENT folder.
* Searched all other user settings in the web interface.
* Googled for answers but nobody seems to know a method to do this.
Posted
Updated 19-Jan-23 9:08am
Comments
Dave Kreskowiak 19-Jan-23 14:54pm    
Show the code you're using to setup and send the email.

1 solution

If you're using the SMTP route into Outlook365, you do not have the option of turning SentItems off. On normal servers, using SMTP does not put anything in SentItems, but Office365 is not the standard email environment the web uses. Things are a little ... different.

To get the option to stop saving a copy of the email in SentItems, you would have to use the Exchange WebServices client. There's it's really easy to not save emails in SentItems. Once your email and connection are setup, you just call the Send method instead of SendAndSaveCopy method.
 
Share this answer
 
Comments
DerekT-P 20-Jan-23 5:05am    
Thanks Dave. The app sends emails via one of a number of different webservers (customer notices via one, staff via another and support a third) so I would prefer to keep it all the same code. I'll stick with SMTP and diarise a note to clear the SENT folder every 3 months. Why MS has to change the standard action of an SMTP send is beyond me.
Dave Kreskowiak 20-Jan-23 19:15pm    
If you're using SMTP, you don't have the option of turning that off in your code.

It has to be done server-side through some config policy.
DerekT-P 21-Jan-23 8:12am    
Yep, I understand. I mean I'll go in manually every so often and empty out the sent folder. The issue is not so much that I don't want to keep a copy, but that I don't want the folder to hit the (any) storage limit, on what is otherwise an unmonitored email account.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900