Solved

How do I send mail from Ms Access Module without Outlook

Posted on 2011-02-18
12
321 Views
Last Modified: 2012-05-11
in ms access i have a module like this;

‘Recipient1
DoCmd.OpenReport "ReportName", acViewPreview, "", "[QueryName]![Fieldname]="" Recipient1"""
DoCmd.SendObject acReport, "ReportName", "MicrosoftExcelBiff8(*.xls)", "a@com", "b@com ", "", "Subject", "Message body", False, ""
DoCmd.Close acReport, "ReportName"

this module repeat till how much recipient i desire. so i run this code whit a macro. i want to run this code bypassing oulook. i have dowloaded cdomail databse. i could send a trial message from there. but dont know how to adapted to the code above.
0
Comment
Question by:umitkilinc
  • 5
  • 3
  • 2
  • +1
12 Comments
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
ID: 34932952
<< i could send a trial message from there. but dont know how to adapted to the code above. >>

  You first need to create the report in some type of output format and save it on disk. You would do this with the output to method in VBA.  For example:

          ' Export the selected Report to SnapShot format
200    DoCmd.OutputTo acOutputReport, RptName, "SnapshotFormat(*.snp)", _
                         strPathandFileName


  Then use the CDO or other SMTP software to send the e-mail message with an attachment.

JimD.
0
 

Author Comment

by:umitkilinc
ID: 34933336
the code i have writen just a modal. i sent for example 100 different mail with that code. so saving on disk not pratic for me.
0
 
LVL 38

Expert Comment

by:Jim P.
ID: 34935486
Try taking a look at the code in this Q:
http://www.experts-exchange.com/Q_23257730.html
0
 
LVL 57
ID: 34939439
<<the code i have writen just a modal. i sent for example 100 different mail with that code. so saving on disk not pratic for me. >>

  Sorry, but you need to save a report in some format on disk to send it as an attachment with the CDO code.

  And there is nothing saying that you can't reuse the same disk file for each send, so the disk space required would be minimal.

JimD.
0
 

Author Comment

by:umitkilinc
ID: 34941930
i think i could not explain myself celaerly. with send object, i can send different mail from a table or query bu choosing a uniq field. and to the different recipient. there is no problem. i just wanna know if i can use sent this mails bypassing outlook.

saving on disk not proper for me.
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 57
ID: 34941987
<<i think i could not explain myself celaerly. with send object, i can send different mail from a table or query bu choosing a uniq field. and to the different recipient. there is no problem. i just wanna know if i can use sent this mails bypassing outlook. >>

  You can do the same thing with a report.

<<saving on disk not proper for me. >>

You only have a few choices in sending e-mail.  If you cannot do it with Sendobject command, then you need to use:

1. Outlook
2. Mapi
3. CDO
4. Direct to SMTP server

  All those methods require saving the output to disk first, then sending as an attachment.  You cannot do it any other way.

JimD.
0
 
LVL 45

Expert Comment

by:aikimark
ID: 34942174
Why would saving each report to disk not be practical?

What email system are you using?
0
 

Author Comment

by:umitkilinc
ID: 34949265
i meant i wanna send those reports by one step. so if it could be by saving on disk and send them one step no problem.

by sending outlook cause annoying security issue. i use clickyes command. it makes operation slowdown.
0
 
LVL 57
ID: 34953220
You can use Redemption to get around the Outlook security issues if that is your only problem:

http://www.dimastr.com/redemption/

  Otherwise, you can use one of the other methods, and yes they would all be automatic and "one step" for all practical purposes.

JimD.
0
 
LVL 38

Expert Comment

by:Jim P.
ID: 34958050
JimD.,

I have had issues -- minor -- with redemption and how it interacts with the registry, and other apps.

umitkilinc,

Have you looked at the code in http://www.experts-exchange.com/Q_23257730.html ?
0
 
LVL 57
ID: 34969876
<<JimD.,

I have had issues -- minor -- with redemption and how it interacts with the registry, and other apps.
>>

  Nice to know.  I don't use it myself.  I use vbSendMail for all my apps and talk directly to the SMTP sever.  Never know if a user will have Outlook, Outlook Express, or something else.   Even CDO can be problematic (although not as much as it once was).

  But sending directly to a SMTP server is as simple as it gets with sending mail.

JimD.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
We were having a lot of "Heartbeat Alerts" in our SCOM environment, now "Heartbeat" in a SCOM environment for those of you who might not be familiar with SCOM is a packet of data sent from the agent to the management server on a regular basis, basic…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now