4D Blog

Home Product Save emails in a specific mailbox

Save emails in a specific mailbox

January 25, 2021

Product

When you send emails from 4D, your customers might expect to get a copy in the “Sent” mailbox displayed by Outlook or Apple Mail. For this, 4D v18 R6 has a new command for you. Say hello to the new IMAP transporter append() function.

HDI IMAP Append

To save an email after sending it, you first need to create two transporters:

  • one SMTP transporter to send your email to your client,
  • and a second IMAP transporter to upload your email onto your server mail.

 

After sending your email with SMTP, use the IMAP transporter append() function:

// SMTP transporter creation
$SMTPTransporter:=SMTP New transporter($SMTPserver)
 
// Send email to the client
$status:=$SMTPTransporter.send($email)
  
// If sending is successful, upload email onto your mail server
If ($status.success)
  // IMAP transporter creation
  $IMAPTransporter:=IMAP New transporter($IMAPserver)
  // Upload email to the "Sent" mailbox
  $status:=$IMAPTransporter.append($email; "Sent")
End if

And that’s it!

Of course, you can use the append() function for other tasks like creating draft emails:

// IMAP transporter creation
$IMAPTransporter:=IMAP New transporter($IMAPserver)
 
// Upload email to the "Drafts" mailbox
$status:=$IMAPTransporter.append($email; "Drafts")

Check out the documentation and the HDI above to learn more about the new features! 

Discuss

Tags IMAP, Mail, v18 R6, v19

Latest related posts

  • February 3, 2026

    4D Write Pro – Adding a margin automatically when bullets are set using standard actions

  • January 22, 2026

    Transform Static Documents into Actionable Knowledge with AIKit

  • January 22, 2026

    Deploy Fluent UI effortlessly in your 4D applications

Fabrice Mainguené
Fabrice Mainguené
• Product Owner •Fabrice Mainguené joined 4D Program team in November, 2016. As a Product Owner, he is in charge of writing the user stories then translating it to functional specifications. His role is also to make sure that the feature implementation delivered is meeting the customer need.After obtaining a Bachelor degree in Computer Science at CNAM, Fabrice joined a small software publishing company as a Windev developer. Then he worked for different companies in industry and trade areas as a Windev and web developer as well as technical advisor on new features.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • AI
  • 4D View Pro
  • 4D Write Pro
  • 4D for Mobile
  • Email
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • Qodly Studio
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 21 R2 Administration AI Artificial Intelligence Build application CI/CD Class Client/Server Code editor Collections Formula Listbox Logs Mail Microsoft 365 Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience vscode Web Word processor

Tags

4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 21 R2 Administration AI Artificial Intelligence Build application CI/CD Class Client/Server Code editor Collections Formula Listbox Logs Mail Microsoft 365 Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience vscode Web Word processor
Subscribe to 4D Newsletter

© 2026 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy