Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Email from Access to Outlook express?

95 views
Skip to first unread message

Mark

unread,
Jan 10, 2001, 8:46:09 PM1/10/01
to
Has anyone got the code to email from Access to Outlook express?

Regards

Mark B


Tom van Stiphout

unread,
Jan 10, 2001, 9:07:29 PM1/10/01
to
On Thu, 11 Jan 2001 14:46:09 +1300, "Mark" <brow...@ihug.co.nz>
wrote:

This is virtually impossible, because Outlook Express does not expose
an object model you could access using Automation.
Use Outlook instead. Or .SendObject for simple situations.

-Tom.

Mark

unread,
Jan 10, 2001, 9:32:17 PM1/10/01
to
Not according to Hans De Schrijver. The thing is I think he may be on
holiday at the moment.

Mark

----- Original Message -----
From: "Hans De Schrijver" <p...@punctualgraphics.com>
Newsgroups: microsoft.public.access.interopoledde
Sent: Wednesday, September 13, 2000 5:29 PM
Subject: Re: Access97 & Email automation w/ Outlook Express


> I found the solution... add the 2 MAPI controls (Session and Message) to
> Access and write the necessary code to create the email using the MAPI
> objects. Works like a charm, also with Outlook Express!
>
> If anyone would like the sample MDB I created to test it out, please let
me
> know.
>
> Hans De Schrijver
>
>
>
> "Hans De Schrijver" <p...@punctualgraphics.com> wrote in message
> news:eVvFjcK...@cppssbbsa02.microsoft.com...
> > I know that this issue has been addressed numerous times, and always I
> found
> > the answer..."Cannot be done with Outlook Express".
> > However, I discovered that from within PageMaker 6.0 and even standard
> > Write.exe, upon selecting Send from the file menu, it properly creates

> new
> > email message with the file attachement filled out... so there IS a way
to
> > communicate with Outlook Express.
> >
> > Does anyone have any clue how they achieve this?
> >
> > Many thanks in advance.
> >
> > -----------------------------
> > Hans De Schrijver
> > PUNCTUAL GRAPHICS USA, Inc.
> > 5424 Rosa Ave.
> > El Paso, TX 79905, USA
> > Tel.: +1/915-778-3700
> > Cell Ph: +1/915-588-5767
> > Fax: +1/603-925-7144
> > Email: p...@punctualgraphics.com

Lyle Fairfield

unread,
Jan 10, 2001, 10:01:54 PM1/10/01
to
Option Explicit

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

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

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

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
Files As Long
FileCount As Long
End Type

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

Sub SendMailWithOE(ByVal strSubject As String, ByVal strMessage As String, ByRef
aRecips As Variant)
Dim recips() As MAPIRecip
Dim message As MAPIMessage
Dim z As Long
ReDim recips(LBound(aRecips) To UBound(aRecips))
For z = LBound(aRecips) To UBound(aRecips)
With recips(z)
.RecipClass = 1
If InStr(aRecips(z), "@") <> 0 Then
.Address = StrConv(aRecips(z), vbFromUnicode)
Else
.Name = StrConv(aRecips(z), vbFromUnicode)
End If
End With
Next z
With message
.NoteText = strMessage
.Subject = strSubject
.RecipCount = UBound(recips) - LBound(aRecips) + 1
.Recipients = VarPtr(recips(LBound(recips)))
End With
MAPISendMail 0, 0, message, 0, 0
End Sub

Sub TestSendMailwithOE()
Dim aRecips(0 To 0) As String
aRecips(0) = "smtp:to...@syspac.com"
SendMailWithOE "Send Mail Through OE", "Sure, you can, Tom!", aRecips
End Sub

no.spa...@syspac.com (Tom van Stiphout) wrote in
<3a5d1511...@news.syspac.com>:

--
Lyle
http://www.cyriv.com/

Steve Jorgensen

unread,
Jan 10, 2001, 10:25:12 PM1/10/01
to
I suppose you could use the MAPI interface. This will not allow you
to e-mail through Outlook Express explicitly, but it will allow you to
send mail using whatever MAPI compliant e-mail client is running, or
whichever is the default if none is already running.

When Outlook Express is the only installed e-mail client, MAPI will
always use Outlook Express - otherwise, it will use something, and
should do the same job the same way so long as "something" is well
behaved.

On Thu, 11 Jan 2001 14:46:09 +1300, "Mark" <brow...@ihug.co.nz>
wrote:

>Has anyone got the code to email from Access to Outlook express?
>
>Regards
>
>Mark B
>
>
>
>

Tom van Stiphout

unread,
Jan 11, 2001, 2:39:54 PM1/11/01
to
On Thu, 11 Jan 2001 03:01:54 GMT, lyle...@yahoo.com (Lyle Fairfield)
wrote:

I received your message, and stand corrected.
-Tom.

<clip>


>
>Sub TestSendMailwithOE()
> Dim aRecips(0 To 0) As String
> aRecips(0) = "smtp:to...@syspac.com"
> SendMailWithOE "Send Mail Through OE", "Sure, you can, Tom!", aRecips
>End Sub
>

<clip>

michael (michka) kaplan

unread,
Jan 13, 2001, 12:45:49 AM1/13/01
to
I do wish you would get rid of those byte arrays, though! :-(

--
MichKa

a new book on internationalization in VB at
http://www.i18nWithVB.com/

"Lyle Fairfield" <lyle...@yahoo.com> wrote in message
news:Xns9025E8880ly...@24.2.9.58...

puneet

unread,
Dec 16, 2004, 4:39:21 AM12/16/04
to

' Help Provided By: Puneet Kaur , Nidhi Sharma(India)

Private Type MapiRecip


Reserved As Long
RecipClass As Long
Name As String
Address As String
EIDSize As Long

EntryID As Long
End Type

Private Type MAPIFileDesc
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, _

Message As MAPIMessage, _
ByVal flags As Long, _


ByVal Reserved As Long) As Long

Private Sub SendMailWithOE(ByVal vSubject As String, _
ByVal vMessage As String, _
ByRef vRecipients As String, _
Optional ByVal vFiles As String)

Dim aFiles() As String
Dim aRecips() As String

Dim FilePaths() As MAPIFileDesc
Dim Recips() As MapiRecip
Dim Message As MAPIMessage

Dim z As Long

aFiles = Split(vFiles, ",")
ReDim FilePaths(LBound(aFiles) To UBound(aFiles))
For z = LBound(aFiles) To UBound(aFiles)
With FilePaths(z)
.Position = -1
.PathName = StrConv(aFiles(z), vbFromUnicode)
End With
Next z

aRecips = Split(vRecipients, ",")
ReDim Recips(LBound(aRecips) To UBound(aRecips))


For z = LBound(aRecips) To UBound(aRecips)

With Recips(z)


.RecipClass = 1
If InStr(aRecips(z), "@") <> 0 Then
.Address = StrConv(aRecips(z), vbFromUnicode)
Else
.Name = StrConv(aRecips(z), vbFromUnicode)
End If
End With
Next z

With Message
.FileCount = UBound(FilePaths) - LBound(FilePaths) + 1
.Files = VarPtr(FilePaths(LBound(FilePaths)))
.NoteText = vMessage
.RecipCount = UBound(Recips) - LBound(Recips) + 1
.Recipients = VarPtr(Recips(LBound(Recips)))
.Subject = vSubject
End With
MAPISendMail 0, 0, Message, 0, 0

End Sub

Sub Splitter()

Dim mask As String
Selection.EndKey Unit:=wdStory
Letters = Selection.Information(wdActiveEndSectionNumber)
mask = "ddMMyy"

Selection.HomeKey Unit:=wdStory
Counter = 1
While Counter < Letters + 1
DocName = "c:\temp\" & Format(Date, mask) & " " &
LTrim$(Str$(Counter))
ActiveDocument.Sections.First.Range.Cut
Documents.Add
With Selection
.Paste
.EndKey Unit:=wdStory
.MoveLeft Unit:=wdCharacter, Count:=1
.Delete Unit:=wdCharacter, Count:=1
End With

ActiveDocument.SaveAs FileName:=DocName,
FileFormat:=wdFormatDocument
Call sendEMail(ActiveDocument)
ActiveWindow.Close
Counter = Counter + 1
Wend
End Sub


Sub sendEMail(MainDoc As Word.Document)
Dim fld As Word.Field
Dim emailTo As String
Dim Mess As String
Dim Subject As String

Selection.HomeKey Unit:=wdStory
Selection.EndKey Unit:=wdLine, Extend:=wdExtend

emailTo = Selection
emailTo = Left(emailTo, InStr(emailTo, " ") - 1) + Mid(emailTo,
InStr(emailTo, " ") + 1, 1) _
+ "@<domain.com>"
Mess = "Sending email to: " + emailTo
Subject = "Test"

SendMailWithOE Subject, Mess, emailTo, "<Put your file-path here>"
End Sub

0 new messages