1

I use go-mail library to send emails with smtp. But I faced common issue that sent emails won't appear in sent folder. Googling I found that the only way to solve it is to upload sent email though imap.

The question is how do I obtain copy of sent email with smtp email?

ogbofjnr
  • 1,688
  • 5
  • 19
  • 41
  • Some services (e.g. [Google Apps](https://support.google.com/a/answer/3547347#) and [Office 365](https://learn.microsoft.com/en-us/exchange/mail-flow-best-practices/how-to-set-up-a-multifunction-device-or-application-to-send-email-using-microsoft-365-or-office-365#compare-the-options)) offer this functionality but it's a server feature (you often need to enable it and use SMTP AUTH) rather than something covered by the SMTP standard. – Brits Jul 28 '22 at 07:25
  • 1
    See if the mail system that you use supports “direct mailbox addressing” - in that case it may be possible to Bcc mail to something like Sent#user@domain for the mail to be stored directly to the Sent folder of user@domain account. – Outtruder Jul 28 '22 at 08:51
  • 1
    This is how I summarized the double-submission problem a year ago: https://explained-from-first-principles.com/email/#double-submission-problem – Kaspar Etter Jul 28 '22 at 13:34
  • @Outtruder: Interesting, I've never heard about "direct mailbox addressing". Do you know which mail server software supports this? So far, I haven't found much about it through Google (I get only around 300 results): https://www.google.com/search?q=%22direct+mailbox+addressing%22 – Kaspar Etter Jul 28 '22 at 13:40
  • 1
    The normal way to do this is with IMAP append. – Max Jul 28 '22 at 13:55
  • It’s a variant of so called subaddressing covered in Wikipedia article on email addresses. CommuniGate Pro supports direct mailbox addressing. – Outtruder Aug 03 '22 at 06:41

2 Answers2

0

The question is how do I obtain copy of sent email with smtp email?

You can't. SMTP is just for delivering mail. There is no concept of users mailboxes and specifically the Sent folder within SMTP.

Steffen Ullrich
  • 114,247
  • 10
  • 131
  • 172
  • But there are lot of programs that do this somehow. So far I came up with using bcc. – ogbofjnr Jul 28 '22 at 05:50
  • @ogbofjnr: *"But there are lot of programs that do this somehow"* - please be more specific. Which programs do this and how do you come to the conclusion, that this is done purely with SMTP as you want. *"So far I came up with using bcc."* - This is not putting mail into the Sent folder. This is simply delivering the mail to you too - and it will end up in your Inbox unless you have some automatic rules which will move it from there to the Sent folder. – Steffen Ullrich Jul 28 '22 at 06:53
  • One which I used called apollo.io, but I'm sure all services for email blasts has this capability. Then I'm going to move the email to sent with imap. – ogbofjnr Jul 28 '22 at 07:44
0

We've implemented the following approach and it works for us:

  1. Send email with smtp and bcc to own email.
  2. Move/upload email with imap to sent folder.
  3. For polling new messages use UID which is auto increment, so just remember the last processed and download all that is more than that.
ogbofjnr
  • 1,688
  • 5
  • 19
  • 41