473,394 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Repost: Attachments to Outlook Express possible?

Hi all,

This is a repost of a message posted at october 6.
The answer I got was about MapiMessages.AttachmentIndex.
I think I need the MSMAPI32.OCX to use this. (I don't have this file on my PC)

My newsaccount wasn't working anymore until yesterday, so I'll try again.

Question is:
I know it is possible to send email with Access, but can one also automate the attachments?
Question has been asked a lot I know...
I've searched Google but *all* answers that work use Outlook or commercial apps?
So I have not been able yet to automate the attachment-issue using Outlook Express.
Any ideas or 'new' insight?
(Using Access '97 or Access 2000)

TIA
Arno R

Nov 12 '05 #1
12 4682
Arno,
did you look on Tony Toews'site in the e-mail section? I'm almost
positive it's all covered there.

http://www.granite.ab.ca/access/email.htm
Nov 12 '05 #2
"Arno R" <ar****************@tiscali.nl> wrote in
news:3f********************@dreader2.news.tiscali. nl:
Hi all,

This is a repost of a message posted at october 6.
The answer I got was about MapiMessages.AttachmentIndex.
I think I need the MSMAPI32.OCX to use this. (I don't have this file on
my PC)

My newsaccount wasn't working anymore until yesterday, so I'll try
again.

Question is:
I know it is possible to send email with Access, but can one also
automate the attachments? Question has been asked a lot I know...
I've searched Google but *all* answers that work use Outlook or
commercial apps? So I have not been able yet to automate the
attachment-issue using Outlook Express. Any ideas or 'new' insight?
(Using Access '97 or Access 2000)

TIA
Arno R


This class should send attachments via Outlook Express. But WHY? CDO is
much simpler and much stronger.

Option Explicit

Private Type MAPIRecip
Reserved As Long
RecipClass As Long
Name As String
Address As String
EIDSize As Long
EntryID As String
End Type

Private Type MAPIFileTag
Reserved As Long
TagLength As Long
Tag() As Byte
EncodingLength As Long
Encoding() As Byte
End Type

Private Type MAPIFile
Reserved As Long
Flags As Long
Position As Long
PathName As String
FileName As String
FileType As Long
End Type

Private Type MAPIMessage
Reserved As Long
Subject As String
NoteText As String
MessageType As String
DateReceived As String
ConversationID As String
Originator As Long
Flags As Long
RecipCount As Long
Recipients As Long
FileCount As Long
Files As Long
End Type

Private Declare Function MAPISendMail _
Lib "c:\program files\outlook express\msoe.dll" ( _
ByVal Session As Long, _
ByVal UIParam As Long, _
ByRef message As MAPIMessage, _
ByVal Flags As Long, _
ByVal Reserved As Long) As Long

Private Const MAPI_E_NO_LIBRARY = 999
Private Const MAPI_E_INVALID_PARAMETER = 998

Private Const MAPI_ORIG = 0
Private Const MAPI_TO = 1
Private Const MAPI_CC = 2
Private Const MAPI_BCC = 3

Private Const MAPI_UNREAD = 1
Private Const MAPI_RECEIPT_REQUESTED = 2
Private Const MAPI_SENT = 4

Private Const MAPI_LOGON_UI = &H1
Private Const MAPI_NEW_SESSION = &H2
Private Const MAPI_DIALOG = &H8
Private Const MAPI_UNREAD_ONLY = &H20
Private Const MAPI_ENVELOPE_ONLY = &H40
Private Const MAPI_PEEK = &H80
Private Const MAPI_GUARANTEE_FIFO = &H100
Private Const MAPI_BODY_AS_FILE = &H200
Private Const MAPI_AB_NOMODIFY = &H400
Private Const MAPI_SUPPRESS_ATTAch = &H800
Private Const MAPI_FORCE_DOWNLOAD = &H1000

Private Const MAPI_OLE = &H1
Private Const MAPI_OLE_STATIC = &H2
Dim mAf() As MAPIFile
Dim mAr() As MAPIRecip
Dim lAr As Long
Dim lAf As Long
Dim mM As MAPIMessage
Dim aErrors(0 To 26) As String

Private Sub Class_Initialize()
aErrors(0) = "Success"
aErrors(1) = "User Abort"
aErrors(2) = "Failure"
aErrors(3) = "LogIn Failure"
aErrors(4) = "Disk Full"
aErrors(5) = "Insufficient Memory"
aErrors(6) = "Block Too Small"
aErrors(8) = "Too Many Sessions"
aErrors(9) = "Too Many Files"
aErrors(10) = "Too Many Recipients"
aErrors(11) = "Attachment No Found"
aErrors(12) = "Attachment Open Failure"
aErrors(13) = "Attachment Write Failure"
aErrors(14) = "Unknown Recipient"
aErrors(15) = "Bad Recipient"
aErrors(16) = "No Messages"
aErrors(17) = "Invalid Message"
aErrors(18) = "Text Too Large"
aErrors(19) = "Invalid Session"
aErrors(20) = "Type Not Suppported"
aErrors(21) = "Ambiguous Recipient"
aErrors(22) = "Message in Use"
aErrors(23) = "Network Failure"
aErrors(24) = "Invalid Edit Fields"
aErrors(25) = "Invalid Recipient"
aErrors(26) = "Not Supported"
End Sub

Public Sub BCCAddressAdd(ByVal strAddress As String)
RecipientAdd MAPI_BCC, , strAddress
End Sub

Public Sub BCCNameAdd(ByVal strName As String)
RecipientAdd MAPI_BCC, strName
End Sub

Public Sub CCAddressAdd(ByVal strAddress As String)
RecipientAdd MAPI_CC, , strAddress
End Sub

Public Sub CCNameAdd(ByVal strName As String)
RecipientAdd MAPI_CC, strName
End Sub

Public Sub MessageIs(ByVal strNoteText As String)
mM.NoteText = strNoteText
End Sub

Public Sub SubjectIs(ByVal strSubject As String)
mM.Subject = strSubject
End Sub

Public Sub ToAddressAdd(ByVal strAddress As String)
RecipientAdd MAPI_TO, , strAddress
End Sub

Public Sub ToNameAdd(ByVal strName As String)
RecipientAdd MAPI_TO, strName
End Sub

Public Sub FileAdd(ByVal strPathName As String)
Dim f As MAPIFile
With f
.PathName = StrConv(strPathName, vbFromUnicode)
End With
ReDim Preserve mAf(lAf)
mAf(lAf) = f
lAf = lAf + 1
End Sub

Public Sub Send()
Dim r As Long
With mM
If lAf > 0 Then
.FileCount = lAf
.Files = VarPtr(mAf(0))
End If
If lAr > 0 Then
.RecipCount = lAr
.Recipients = VarPtr(mAr(0))
r = MAPISendMail(0, 0, mM, 0, 0)
If r <> 0 Then MsgBox aErrors(r)
End If
End With
End Sub

Private Sub RecipientAdd(ByVal lngType As Long, _
Optional ByVal strName As String, Optional ByVal strAddress As String)
Dim r As MAPIRecip
r.RecipClass = lngType
If strName <> "" Then r.Name = StrConv(strName, vbFromUnicode)
If strAddress <> "" Then r.Address = StrConv(strAddress,
vbFromUnicode) ReDim Preserve mAr(lAr)
mAr(lAr) = r
lAr = lAr + 1
End Sub
--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #3
Hi Pieter, thanks for replying.

(Again my newsserver is not working @#$%@##$$
so I created a Google-account to reply)

I did search and looked (more than once) on Tony's site. Good stuff
and good info but not exactly on the topic I need.
Maybe I misread or overlooked, but I only found examples including
attachments that used Outlook (not Outlook Express)or it was third
party vendor stuff.
What I am looking for is a way to automate emails with and without
attachments that will *always* work with my clients.
I prefer not to use ocx-controls or dll's that might not be present at
my client's computers.

Arno R

pi********@hotmail.com (Pieter Linden) wrote in message news:<bf**************************@posting.google. com>...
Arno,
did you look on Tony Toews'site in the e-mail section? I'm almost
positive it's all covered there.

http://www.granite.ab.ca/access/email.htm

Nov 12 '05 #4
Hi Lyle,
This class should send attachments via Outlook Express. But WHY? CDO is
much simpler and much stronger.

I need info for OE because not all of my clients will have the
CDO-library installed.
Or am I missing something obvious here?

Thanks very much for the info but, could you explain a bit more on how
to use this code please?
I guess I start with initializing the class but this immediately
errors?

TIA
Arno R
Nov 12 '05 #5
ar*****@tiscali.nl (Arno R) wrote in news:7599ce12.0310230414.34a5a665
@posting.google.com:
Hi Lyle,
This class should send attachments via Outlook Express. But WHY? CDO is
much simpler and much stronger.

I need info for OE because not all of my clients will have the
CDO-library installed.
Or am I missing something obvious here?

Thanks very much for the info but, could you explain a bit more on how
to use this code please?
I guess I start with initializing the class but this immediately
errors?


Should I guess what these errors are?

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #6
Hi Pieter, thanks for replying.

I did search and looked (more than once) on Tony's site. Good stuff and good info but not exactly on
the topic I need.
Maybe I misread or overlooked, but I only found examples including attachments that used Outlook
(not Outlook Express)
or it was third party vendor stuff.
What I am looking for is a way to automate emails with and without attachments that will *always*
work with my clients.
I prefer not to use ocx-controls or dll's that might not be present at my client's computers.

"Pieter Linden" <pi********@hotmail.com> schreef in bericht
news:bf**************************@posting.google.c om...
Arno,
did you look on Tony Toews'site in the e-mail section? I'm almost
positive it's all covered there.

http://www.granite.ab.ca/access/email.htm


Nov 12 '05 #7
Lyle, I am not waiting for such a 'guess'.
What I need is an answer that I understand.

If I ask stupid questions allright, let me know, but I still would appreciate if you help me out on
this.

Arno R
"Lyle Fairfield" <Mi************@Invalid.Com> schreef in bericht
news:Xn*******************@130.133.1.4...
ar*****@tiscali.nl (Arno R) wrote in news:7599ce12.0310230414.34a5a665
@posting.google.com:
Hi Lyle,
This class should send attachments via Outlook Express. But WHY? CDO is
much simpler and much stronger.

I need info for OE because not all of my clients will have the
CDO-library installed.
Or am I missing something obvious here?

Thanks very much for the info but, could you explain a bit more on how
to use this code please?
I guess I start with initializing the class but this immediately
errors?


Should I guess what these errors are?

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)

Nov 12 '05 #8
I guess I start with initializing the class but this immediately
errors?
Should I guess what these errors are?

Lyle would like to know what error you are referring to. I believe it's
because of some line wraps at wrong positions:
Private Sub RecipientAdd(ByVal lngType As Long, _ ...
...
If strAddress <> "" Then r.Address = StrConv(strAddress,
vbFromUnicode) ReDim Preserve mAr(lAr)


should read:

If strAddress <> "" Then r.Address = _
StrConv(strAddress, vbFromUnicode)
ReDim Preserve mAr(lAr)
HTH - Peter

--
No mails please.
Nov 12 '05 #9
"Arno R" wrote
Lyle, I am not waiting for such a 'guess'.
What I need is an answer that I understand.

If I ask stupid questions allright, let me
know, but I still would appreciate if you
help me out on this.


Lyle and I have disagreed on many issues, but I agree with him on this one.
If you want help, you have to describe the problem in detail and with care.
Precise and concise questions are the ones most likely to be answered. Don't
whine when someone helping you asks for information, even if you think that
person is being "snippy".

A perfectly understandable response to a whine in reply to a request for
information needed to help someone is no response at all. However, it would
likely be worth your while to provide the specific information he asked
about. He might then be able to help, or someone else might.

Larry Linson
Nov 12 '05 #10
Hi Chuck,
Thanks for your reply,
BTW, what are your plans for places that have OE removed, or places
that use Groupwise? (OE and Groupwise don't get along all that well!)


To be more specific: All my clients (for this specific app) have 'at least' OE installed.
Some have Outlook or other mail-clients (Eudora is one of them).
I guess they all are MAPI-compliant or not?
So what I really need is a generic MAPI-solution without ocx-controls or dll's
that might not be present at my client's computers.
Arno R
Nov 12 '05 #11
Hi Lyle,
I guess I owe you an apology. I totally misread your reply!
I am really sorry for that!
Peter and Larry both are teling me that you are right, and you are!
I totally misunderstood your 'guessing'. (I guess I was a bit pissed because my newsserver failed
again)
Again: I am sorry and appreciate your help.

It's not the line-wrap that errors (thanks Peter) but it's probably the fact that I don't fully
understand the code.
So I ask for more explanation. (Hope I am specific enough now)

What did I try?
I pasted the code in a new module. (fixed the line-wrap)
I get an error on the first line with code in a form like:

Sub TestMail()
Class_Initialize
ToAddressAdd "ad*****@test.nl"
BCCAddressAdd "in**@test.nl"
MessageIs "bla bla" & vbNewLine & "second line here"
SubjectIs "Testmail"
FileAdd "C:\test\test.zip"
Send
end sub

If I comment-out the first line indeed a mailmessage (with attachment!) shows up in the OE-Outbox,
great!!
But how or when is the Class_Initialize code used?

Other problems:
When I use the sub again the ToAddress-line and BCCAddress-line are doubled.
ToAddress: ad*****@test.nl;ad*****@test.nl
BCCAddress: in**@test.nl;in**@test.nl
Also the attachment shows up twice
(or trippled on the third try and so on)
What am I doing wrong ?

Arno R
"Lyle Fairfield" <Mi************@Invalid.Com> schreef in bericht
news:Xn*******************@130.133.1.4...
ar*****@tiscali.nl (Arno R) wrote in news:7599ce12.0310230414.34a5a665
@posting.google.com:
Hi Lyle,
This class should send attachments via Outlook Express. But WHY? CDO is
much simpler and much stronger.

I need info for OE because not all of my clients will have the
CDO-library installed.
Or am I missing something obvious here?

Thanks very much for the info but, could you explain a bit more on how
to use this code please?
I guess I start with initializing the class but this immediately
errors?


Should I guess what these errors are?

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)

Nov 12 '05 #12
Hi Lyle,

I just found out what I did wrong and I'm a little embarassed about it...
Its class-code, so I need to paste the code in a class-module and use the class!
Obviously I am not used to class-code ;-)
Anyhow, finally I got it working. I think I need to study more about classes now!

Thanks,
Arno R

Nov 12 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: John P | last post by:
Hello, I'm building email messages and attachments via the JavaMail API, which are then sent via sendmail. The attachments are mime attachments of type "application/octet-stream". They are...
3
by: AspDotNetDeveloper | last post by:
I'm trying to troubleshoot why my ASP application can no longer send file attachments larger than 100K, and I have eliminated many possibilities already, but I'm running out of ideas. I think I...
2
by: Arno R | last post by:
Hi all, I know it is possible to send email with Access, but can one also automate the attachments? Question has been asked a lot I know... I've searched Google but *all* answers that work use...
5
by: paii, Ron | last post by:
How do I setup a email with attachment for preview but require the user to push the SEND button in Outlook. I have the following function but it sends the email without the sender ever seeing it. ...
6
by: A.M-SG | last post by:
Hi, I have an aspx page at the web server that provides PDF documents for smart client applications. Here is the code in aspx page that defines content type: Response.ContentType =...
14
by: Steve McLellan | last post by:
Hi, Sorry to repost, but this is becoming aggravating, and causing me a lot of wasted time. I've got a reasonably large mixed C++ project, and after a number of builds (but not a constant...
5
by: Adrian Parker | last post by:
I've got the standard SqlCacheDependency working just fine , ie. I've defined (and encrypted) the connectionStrings section in the web.config, and I've also defined an an sqlCacheDependency in the...
0
by: DC | last post by:
I have a requirement for an application that, through drag and drop, takes the email attachments from Outlook 2000 desktop clients and sends them in binary format to a SQL Server database. At this...
1
by: =?Utf-8?B?U2VyZW5h?= | last post by:
For some reason .jpg attachments, infact any attachments in outlook express have all of a sudden decieded to take ages to open but if saved on the hard disc they open in a flash. i use Windows XP...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.