Help

Re: How to preview a mail

67 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Zeely_Beg408
4 - Data Explorer
4 - Data Explorer

Hello everyone,

I need a little help about how to preview an email before send it. 

I explain myself, I need people who uses my interface to be able to preview their email  before send it.

What I have now is when an entry is create by an automation  I have a script who send it (Outlook) but don't allow to preview the mail.

I came up with an idea is to create a formula with "mailto" who allows to have an interaction with outlook with that I create a bouton and when people click on the bouton is create a preview of their mail directly on outlook with the information they put in a formulaire when the creation of an entry.

But I have two problems : 

- "Mailto to" not allow html so I create a macro in Outlook to put my text into html format

- Limitation of numbers of characters by 2000 so i can only use Firefox for browser

So I don't have any idea to find something more optimized because I have an html format kinda complexe for the content of my mail and I need to allow preview a mail.

Thank you for your help,

Zeely

 

2 Replies 2
alison569
4 - Data Explorer
4 - Data Explorer

Hi Zeely,

It sounds like you're trying to offer a way for users to preview emails in HTML format via Outlook before they send them, but you're hitting some limitations with the `mailto:` approach, particularly the lack of HTML support and character limits.

### Here are a couple of alternative approaches that might help you achieve this:

### 1. **Create a Draft Email in Outlook Using a Script (VBA or Office Script)**
Instead of using `mailto:`, you can use **Outlook VBA** or **Office Script** to programmatically create an email draft that will open in Outlook with the content, including HTML formatting. Users can then preview, edit, and send the email themselves.

Here's an example VBA code that creates an HTML email draft:

```vba
Sub CreateDraftEmail()
Dim olApp As Outlook.Application
Dim olMail As Outlook.MailItem

Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.CreateItem(olMailItem)

With olMail
.To = "recipient@example.com"
.Subject = "Email Subject"
.HTMLBody = "<html><body><h1>Hello!</h1><p>This is a test email.</p></body></html>"
.Display 'This opens the email in draft mode
End With
End Sub
```

This code opens the email in the Outlook editor with the provided HTML content, and the user can manually review it before sending.

### 2. **Use an External Email API for Preview**
Another option is to use an email API service, like **SendGrid**, **Mailgun**, or **SMTP**, where you can first generate the email in HTML format and send a preview of it to Outlook or any other email client.

- You can generate the email content and send it to the user’s inbox for review.
- Users can open the email, review it, and then decide whether to forward it or use an Outlook add-in to approve and send it.

### 3. **Embed an Email Preview in Your Interface**
If you're using a web interface, you can create an HTML email preview inside the interface itself. This would involve:

- Generating the HTML email content based on the user input.
- Rendering the email as a preview directly in the browser before sending it.

After the preview is confirmed, you can use an API or Outlook integration to send the actual email.

### 4. **Automate HTML Formatting via Macro**
You mentioned you already have a macro to convert the text to HTML. You can expand on this to dynamically create the email and open it as a draft for preview. Since Outlook VBA has no character limit, this method should solve your `mailto:` limitations.

### Final Thoughts
The VBA or Office Script method should be the most direct and seamless if you are working within Outlook. It gives you full control over HTML formatting, and the email is opened for the user to preview and manually send.

Let me know if you need more details on any of these methods or have additional questions!

 

TravisStacy
4 - Data Explorer
4 - Data Explorer

Hi Zeely,

You’ve done a fantastic job putting this solution together! It’s clear that you’ve thought through the user experience by providing a way to preview emails, which is definitely a helpful addition.

To address the "mailto" HTML limitation and character cap, here are a few alternative ideas that might help:

  1. Outlook Draft Emails: Instead of sending the email directly, you might be able to adjust your script to create a draft in Outlook. This way, users could view and edit the email as a draft with full HTML formatting before sending.

  2. Using Power Automate: If you have access to Microsoft Power Automate, it could allow you to create draft emails directly in Outlook using data from forms, bypassing the "mailto" constraints and supporting more complex HTML.

  3. Advanced VBA Scripting: Since you’re already working with macros, another approach could be to enhance the VBA script to create a draft email with the necessary HTML. This would avoid both the character limit and browser dependency, offering more flexibility for your HTML content.

Each of these ideas could help preserve the complex formatting and allow for a preview feature. Let us know how it goes or if you’d like more help with the VBA option—great job, and I’m sure you’ll have a smooth solution in place soon!