Web script to create emails from MS-Access db

G'day all,

I'm trying to send an email from an MS-access database which has a table containing several questions I want sent in an html email. Obviously the customer details and email address are also contained in the database. I'm not even sure if this can be done natively in Access or whether I will have to use a scripting language to generate the email after pulling the neccessary data from the tables.....

Any pointer would be great.

Greeting, Chyro
CHYROAsked:
Who is Participating?
 
DanielcmorrisConnect With a Mentor Commented:
you can't do it with sendobject.

use the outlook object.  I just tested it and it worked great.

Dim OutlookApp As Outlook.Application
Dim OutlookMessage As Outlook.MailItem

Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMessage = OutlookApp.CreateItem(olMailItem)

Dim EmailSubject As String
Dim EmailMessage As String

EmailSubject = "TEST SUBJECT"
EmailMessage = "<FONT SIZE='2' FACE='ARIAL' COLOR='#000080'> TEST MESSAGE </FONT>"

OutlookMessage.HTMLBody = EmailMessage
OutlookMessage.Subject = EmailSubject
OutlookMessage.To = "user@domain.com"
OutlookMessage.CC = "user@domain.com;user2@domain.com"


'OutlookMessage.Display

OutlookMessage.Send

____________________________

First you'll need to make a reference to the Microsoft Outlook 9.0 Object Library  (go to tools->references and select "Microsoft Outlook 9.0 Object Library")



http://morrisdev.com/info/OutlookEmail.asp

(I just started to keep a library  :)
0
 
Eddie ShipmanAll-around developerCommented:
Where is the database? IS it on a local machine with internet access or is it on a web server?

You could do it using either Access VBA or ASP depending upon the location of the database.
0
 
Eddie ShipmanAll-around developerCommented:
Remember, if you use Outlook to do the sending of the emails, you must use something like Redemption to
facilitate getting around the new security features of Outlook to be able to send email from a 3rd party app.
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
DanielcmorrisCommented:
there is also a command in access

docmd.send  "myreport" or something like that.  
0
 
CHYROAuthor Commented:
Hiya guys,

The database will not be on a web server, and yep I use outlook on the database machine to send the emails.
I am aware of the the 'new' security features of Outlook and redemption's ability to get around them. I use a program called expressclickyes, which I heard about on a post within EE a couple of years ago. It basically captures the dailog box which asks if you want to allow the outgoing email and clicks 'yes' programmatically.
I need more to know how to extract the questions from the database and them create an email with outlook in a presentable html format, complete with check boxes etc.......

Cheer, Chyro
0
 
CHYROAuthor Commented:
Hi Everyone,

Just to reconfirm.... it's not the actual sending of emails I am having trouble with its more the actual format and the inclusion of check boxes in the form (perhaps with a html template??) that I need help on.... I already use the sendobject function.

Cheers, Chyro
0
 
EricConnect With a Mentor Commented:
should work fine for you .. the logic beind it would be:

create mail message
  load email from database
  load subject from datbase

<insert html template code here>

send email mesage
loop till end of address list


---------------------------------
if you send an html email message, you'll need to have it link to a form-reply page located on a sever though to get the answers back to you.

you might be better off just to create a form page on the internet, and then just send a link to the users to click on in their email message.  



0
 
webwomanConnect With a Mentor Commented:
You can't have a form in the email. It won't work.

Set up a web page with the form and send them a link. That works. Forms in emails DO NOT work.
0
 
CHYROAuthor Commented:
Hi egiblock,

Do you have an example of any <html template code>
That could get me started, I have never inserted html template code, and have absolutely no idea of what it is I should insert to create tables, radio buttons and check boxes etc ?

Cheers, Chyro
0
 
CHYROAuthor Commented:

What I am thinking is that I can just create the questionnaires html code in dreamweaver and then paste it into my access application - is that what you mean ?

If so, how do I pass the variables for the questions and their scoring into the html code ? DO i just treat them like normal variables in VB ?

Cheers, Chyro
0
 
webwomanCommented:
No. That's not how it works. You put NOTHING in Access. You can't do this in Access. You can't create the form or anything to do with it in Access. You can't use it for anything but holding the responses, AND it has to sit on a Windows web server AND it has to be configured correctly AND you have to have all the permissions set right.
0
 
CHYROAuthor Commented:
So webwoman,

If you can't put ANYTHING in access, what did egiblock mean in his above post when he wrote :-

create mail message
  load email from database
  load subject from datbase

<insert html template code here>

send email mesage
loop till end of address list

I'm starting to get a little confused....

Cheers, Chyro
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.