Re: Send Mail w/Access via MAPI



Hi again.

A) If MAPI32.DLL does not expose a COM object then which options *do* I
have to send email via the default email client from my Access application?

B) You ask if I can use the MAPI control from VB6 in Access. I am not sure
what you mean if I "could". If I would be able to reference it, I wouldn't
mind using it. The problem is that so far I was unable to reference anything
MAPI in Access.
I appreciate the interest you're taking.
Thankfully, YisMan


"Dmitry Streblechenko" wrote:

Simple MAPI is exposed as a set of 12 regular functions exported from the
mapi32.dll. There is no COM object, hence you cannot access them from a
script.
Can yu use the MAPI control from VB6 in Access?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"YisMan" <yisman@xxxxxxx> wrote in message
news:2B3F9EF2-D085-49BF-A3D3-A05CDF1CB44C@xxxxxxxxxxxxxxxx
Thanks Dmitry,
I appreciate the time you took to answer me.

I would love to use Simple MAPI. But how? I tried referencing in Access
almost any file with the letters MAPI in them (MAPI32.DLL,
MSMAPI32.DLL...)
but Access refuses to accept them. I definitely want to avoid using CDO or
anything tha'ts MS Office Outlook dependant.

Please advise.

--
Thankfully, YisMan


"Dmitry Streblechenko" wrote:

If you need to support most e-mail clients, including Outlookm, OE,
Notes,
etc, use Simple MAPI.
MAPI control in VB uses it internally.
Your code below uses CDO 1.21, which only works if Outlook is installed
and
if CDO 1.21 is installed too - it is an optional component as of Outlook
2003. Outlook 2007 does not even ship with CDO 1.21

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"YisMan" <yisman@xxxxxxx> wrote in message
news:8C120953-4A44-4A62-8FE5-0EAC883DFBE4@xxxxxxxxxxxxxxxx
Hi Everyone, It's me again.

I'm not receiving any answers so I'm back with some details, if it may
help
anyone better understand my problem.

I wrote a vba procedure in MS Access like this:

Sub SendMail(stEMail As String, Optional stRecName As String, Optional
stSubject As String, Optional stBody As String, Optional StAttachPath
As
String)
Dim objMessage As Message
Dim objAttach As Attachment
Dim objRecipient As Recipient
Dim msMessage As String
Dim objSession As New MAPI.Session
objSession.Logon '
Set objMessage = objSession.Outbox.Messages.Add
objMessage.Subject = stSubject
objMessage.Text = stBody

If StAttachPath <> "" Then
objAttach.Source = StAttachPath
Set objAttach = objMessage.Attachments.Add
objAttach.Position = Len(msMessage) + 2
objAttach.Name = "Attachment"
objAttach.Type = CdoFileData
End If

objMessage.Update
Set objRecipient = objMessage.Recipients.Add(stEMail)
objMessage.send showDialog:=False
End Sub

This procedure has several problems:

A) If a machine does not have Office Outlook, It won't run. It must
have
the
CDO.DLL to work. As far as I understand there is a MAPI32.DLL which is
independent of Outlook. I tried to reference it in Access, but I got a
messge
"Can't add a reference to the specified file."

B) Every time the code runs I get a dialog asking me to choose a
profile,
where the only option is Outlook. My users don't want to choose a
profile
for
sending emails. My app will be sending out possibly hundreds of emails
per
session (monthly). The code has to be smart enough to figure out by
itself
which email client to use.

C) Every run of the code gives a security warning from outlook which
must
be
bypassed efficiently.

So to solve the first 2 problems (A & B), I'm sure I can reference a
generic
MAPI session without hardcoding this or that email client. If I'm not
mistaking, I've seen it done in VB .NET. I just don't know how. All the
sample code I've found till now use either Outlook or Outlook Expess
explicitly via automation. How can I avoid limiting my users to one
email
app
or the other?

Additionally, there's problem C (security warning). I've seen alot
written
about it, and I'm not up to it yet. so I won't bother you about it.

Now I just need a way to get the emails out regardless of the email
clients.
Thanks for reading my post. I hope I haven't been to lengthy. If I'm in
the
wrong group, please let me know.
I will be grateful for any leads.
Thankfully, YisMan


"YisMan" wrote:

Hi everyone.

I believe my question to be a simple one, but I need an answer
nontheless.
I've read quite a bit of threads and FAQs, but haven't found a way out
yet.

I'm developing in MS Access 2003 with VBA. My clients would like to
have
automatic emails sent from within their applications. Some of these
clients
use Outlook Express, while some use Office Outlook. Some might also
use
Thunderbird or the likes.

My question is: How can I interact with some sort of generic MAPI
object
and
let windows figure out who is the default email client and use it for
sending
the emails?

My email requirements are pretty simple. Just From, To, Subject,
Text/HTML
Body and attachments.

I'd be grateful for any leads
--
Thankfully, YisMan






.



Relevant Pages

  • Re: Outlook 2033 - detect if Exchange is available
    ... ' .NET Assemblies showing as MAPI: ... ' .NET Assemblies showing as CDO: Microsoft CDO for Windows 2000 Library ... OutlookSpy - Outlook, CDO ... even offline) to an Exchange Server ...
    (microsoft.public.outlook.program_vba)
  • Re: setting MAPI fields in OLK 2003 with .NET 2003
    ... Dim sItem As New Redemption.SafeMailItem, ... 'to convince Outlook something has changed ... OutlookSpy - Outlook, CDO ... yes I'm using CDO to set mapi fields. ...
    (microsoft.public.office.developer.outlook.vba)
  • Re: Exchange/Outlook 2007 MAPI in WinXP
    ... It looks like CDO did the trick. ... Do you really need Outlook? ... But, as you said, the other (MAPI) package will not install if Outlook is ...
    (microsoft.public.win32.programmer.messaging)
  • Re: Report To HTML and email
    ... CDO 1.x is a subset of MAPI. ... MAPI althogether (And security messages issued by Outlook) ...
    (microsoft.public.fox.vfp.reports.printing)
  • Re: Setting Content-ID without CDO or Redemption
    ... OutlookSpy - Outlook, CDO ... CDO therefore I'm using extended MAPI. ... I realise this is a little different to a basic VBA question, ...
    (microsoft.public.win32.programmer.messaging)