Is it possible to place a copy of server sent emails in sent folder using SMTP?

I have configured the Nextcloud server to send email notifications using via SMTP.

The test email and all actual notification emails go out, but there is no copy being placed/saved in the email server’s ‘Sent’ folder.

Is there a way to make this happen?

Hi @DonDowner

No that’s not possible, at least not with the integrated SMTP client. SMTP cannot copy emails to any folders, only mail clients can do that. In order to provide this functionality for the notification emails, a fully-fledged IMAP client would have to be integrated, in addition to the SMTP client.

Why do you like this option? Also a saved email is no evidence.
SMTP is a really stupid communication. Email proves nothing.

Email actually can prove a lot.

Logs are really useful for things like proof of delivery. If the recipient server responded with 250 for example, it means that the message was sent and accepted. Even if the server lied and deleted the message, you have proof that the message was sent and that whatever problems the recipient had were their own responsibility.

Use of sent email records (i.e., backup record of messages that have been sent, which is the topic) are very useful for forensics. Say a client complains about threats sent by one of your employees, if you have a record of all the messages sent through your server, you have what is needed to corroborate or deny their claims as well as a full record of what actually happened.

These are used all the time when dealing with governments. Here (Ontario, Canada), the criminal left-winged prior government was caught out on a lot of criminal activity through email records.

Then of course there’s this;

Now to the actual question of the thread;
ABSOLUTELTY it can be done, but it has nothing to do with Nextcloud. What you need to do is set up the always_bcc parameter or sender_bcc_maps in Postfix (the SMTP server). The full details of that are, of course, well beyond the scope of this forum, but that should be enough information for you to start off with.


Yes. This could be a cool and easy feature. Perhaps someone can write an issue at Github.

Yes, but I think that would have to be done on the sending server not on the SMTP client inside of Nextcloud?

Or maybe the devs could integrate the possibility to add a second email address to which all notifications the Nextcloud server generates are sent. However, for auditing purposes it would probably be better and easier to just archive the activity log.

Why not? I think Nextcloud (PHP) sends the email to the receiver. Why not in copy to another people e.g. admin?

Yes but via an external SMTP server / relay. An SMTP client like PHP mail can only send emails to one or multiple recipients via one or multiple SMTP servers afaik. The emails never get stored anywhere on the client. SMTP simply can’t do that. But on that sending server you could then probably implement what @Larry_Boyd mentioned.

And when it comes to folders like the “Sent” folder @DonDowner mentioned. They have nothing to do with SMTP, although they are often located on the same mail server. Folders are managed by mail clients, usually via IMAP nowdays.

Yes, that could be implemented for sure. But as it stands right now it isn’t, so someone would have to develop the feature.

Thank you all for your input. I was under the understanding that placing a copy in the Sent folder was the job of the email client. And since Nextcloud is acting as an email client when sending via SMTP, that we could add some sort of line to the config.php file that would instruct the client to place this copy of the sent email in the Sent folder.

I also selfhost ERPNext for instance, and that server does have the functionality I am talking about by placing a copy in the Sent folder.

It would be a nice addition. How would I go about “requesting” this feature in case some blessed soul wants to devote some time to do this?

Ah now I get it… :smiley: You of course meant that the mails should be sent to multiple recipients and not somehow copied into a mail folder.

This could be done already. You could install and configure Sendmail on the Nextcloud server and then select “Sendmail” instead of “SMTP” in the Email Server settings in Nextcloud. But from what I have heard it is not exactley fun to set up Sendmail… But maybe it also works with Postfix… :wink:

…and yes this could probably implemented relatively easy to the PHP SMTP Client respective to the WebUI of Nextcloud.

But what @DonDowner wanted is rather unlikely that this will be implemented just to send notifications. If the goal is to keep track about who shared what with whom at what timet etc… I would use the AuditLog and the Activity Log, as I already mentioned.

Yep. But Nextcloud has only implemented the SMTP part of the email client. No IMAP and other features modern email clients usually have.