Link to home
Start Free TrialLog in
Avatar of Steve Sithco
Steve Sithco

asked on

Generate HTML emails from within MS Access Seamlessly and On-the-Fly

I am using Access 2013 and an email DLL library called Redemption. They work together very well and allow me to send emails from within my Access program to all my clients without any Outlook Security warning or any intervention whatsoever. It's seamless. We send all types of emails to our clients, but up until this time most of the emails have been only text.

Now, I want to up the game and send HTML emails with embedded pictures and links.  Does anyone have any experience with this using Redemption or another method? I am open to different options.

Ideally, I want to have the email generated in code and be sent to any client with the click of one button. The access software gets the client's email address from their record automatically. I don't mind having to program the email contents each time for a particular email solicitation.

If there was third party template generator I could just copy that would be great, but I haven't found one to work. For example, I am unable to recreate a mail chimp template in code.  It's not worth moving to an external email engine as I want this to be 1 or 2 client emails that are specifically generated for that client on the fly. Like, you get off the phone with a client and you just finished discussing a particular product and you want to immediately send a product spec sheet with pictures and links. The next client would have a different product, etc.

Any thoughts or idea would be greatly appreciated.
Avatar of Mark Edwards
Mark Edwards
Flag of United States of America image

We're doing that here at Cisco with Windows CDO library on a Citrix installation.  You'll need to know how to write content using HTML.
I've attached a Word .docx with excerpts of the code from one of my apps that gives you the meat of how to do it.
You'll have to do your own research from here.
Using-Windows-CDO-and-Access-VBA-to.docx
<<If there was third party template generator>>
<<Any thoughts or idea would be greatly appreciated.>>

 A good way to back into this is to create a template in Outlook and save it to disk, then read that file and look at the HTML that was generated.

Jim.
Avatar of Steve Sithco
Steve Sithco

ASKER

Okay, good idea. I will give it a try.

Thank you.
Thank you Mark. The code will be a big help. I will try and do the same using the Redemption.dll.
send HTML emails with embedded pictures and links.
Look to using some modern html email templates.
I have had good success with using foundation.zurb's https://foundation.zurb.com/emails/email-templates.html some others to look at may be https://mjml.io/ or https://mosaico.io/.

For images, you don't actually embed them, you save images to a public facing web server or CDN and display like
<img src="https://myserver.com/path_to/image.jpg">

Open in new window


As far as coding, I have coded in vbscript and not vba though I know it is similar.  What Mark provided is similar to what I have done except one step further, I create the template in code allowing for variables where needed. As an example, https://www.experts-exchange.com/questions/28549720/Sending-HTML-Emails.html?anchorAnswerId=40420042#a40420042. Keep in mind that is in vbscript and not vba.

Another thing to keep in mind will be getting your emails to the inbox and tracking bouncebacks.  This is where using a third party smtp service will really  help you instead of using your own system to send emails. I have used mailchimp, mandrill (now part of mailchimp) and sendgrid. All are good choices and all allow you to save create and save templates on their own servers.  All you need to do is call their api with the data you are sending.  If you do not have any variable data, you just need to supply the "to" information unless you are sending a newsletter and you have the data already saved to the service (best choice).  When you view the api for mailchimp for example, they will not give examples for vba code and show cURL.  You will  use xmlhttppost in place of cURL.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.