Full Version: Send multiple custom e-mails from Access
UtterAccess Discussion Forums > Microsoft® Access > Access Automation
bobdee
My app creates a building report.

My users have requested that I provide functionality to e-mail these "building reports" to building managers once a month.

So assuming that I have the following table that lists a building manager's name, e-mail address and their building, is there a way that I can automate this to send these monthly e-mails from Outlook. Ideally this would be a click one button type of action:

Example table:

CODE




Name                E-Mail          Building Nbr



John Doe        john.doe@www.com        443

Mary Smit        mary.smit@www.com        321

Abe Adam        abe.adam@www.com        69


Thanks.

Edited by: bobdee on Sun Sep 17 12:21:24 EDT 2006.
freakazeud
Hi,
you can open a recordset...loop through it and construct a long string value holding all email addresses so you can use it in your email creation method. Sendobject is the simplest, but also most limited...it is really just meant to interact with MS outlook and send only one attachment at a time and only internal db objects as attachments. If any of this conflicts with your set up then search UA for other automation code to achieve what you want. However, a sample of the earlier mentioned method is demonstrated here!
If you want to automate it without having the application open then create a function holding the code...then call this function with a macros RunCode action...you can then use some scheduling software e.g. windows scheduler to call a batch file which uses the macro command line switch to call the macro. Make sure the last action of the macro or the procedure itself is to shut down the application. You can find more details about that method
here!
Of course you can automate it differently, too...e.g. execute the function on the on open event of the first form being loaded or the on timer event of a hidden form or...!
HTH
Good luck
bobdee
Thanks,

I already have this and I don't think it does what I want it to.

I want to send the Building 443 report to only John Doe. I want to send the Building 321 report to only Mary
Smit and so on.

So it would no doubt require some kind of loop. So I guess the method would be

1) Retrieve information from table provided in first post.

2) Loop through each record in that table.

3) Within each loop, run the report and create an e-mail with the name of the appropriate Facility Manager and include a standard message and subject

4) Then Send the E-mail.

I had heard that there can be a problem with sending automated e-mails from Outlook because of the security patches. If there are 100 facility managers, I'd like to avoid the user having to intervene within Outlook for each of the e-mails (i.e. 100 times).

I'm not allowed to install any executables, dlls such as Redemption to help with this. Everything has to be within Access.

Thanks for any help.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.