Модераторы: Akina
  

Поиск:

Ответ в темуСоздание новой темы Создание опроса
> Посылка писем из ACCESS, автоматизация посылки писем по Mail 
:(
    Опции темы
nicka
Дата 6.11.2003, 15:01 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Опытный
**


Профиль
Группа: Участник
Сообщений: 378
Регистрация: 11.6.2003

Репутация: нет
Всего: 1



Проблема заключаеться в следующем:
работаю в ACCESS, надо написать процедуру, которая бы открывала Microsoft OutLook, и при этом сажала на место содержимого письма данные из запроса, и на место адрессата тоже данное из запроса

То есть необходима автоматизация процесса рассылки писем.
Например если запустить в ACCESS-е готовый отчет, то в меню File есть пункт Отправить>>Сообщение(как вложенное), если это использовать, то откроеться Microsoft OutLook и на мемте содержимого письма посадиться содержимое отчета

Нужна команда делающая аналогичные действия, я думаю такое наверняка существует, но не могу найти, например есть HyperLink, но он не позваляет заполнить содержимое письма заданным текстом.

Вот так, жду ответа
PM MAIL   Вверх
Alexei
Дата 6.11.2003, 23:47 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Опытный
**


Профиль
Группа: Участник
Сообщений: 382
Регистрация: 20.8.2003

Репутация: нет
Всего: 4



MAPI контрл

PM MAIL   Вверх
nicka
Дата 10.11.2003, 15:44 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Опытный
**


Профиль
Группа: Участник
Сообщений: 378
Регистрация: 11.6.2003

Репутация: нет
Всего: 1



Код
MAPI контрл


С чем ето едят, please
Поподробнее для невежд пожалуйста
PM MAIL   Вверх
Alexei
Дата 11.11.2003, 17:12 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Опытный
**


Профиль
Группа: Участник
Сообщений: 382
Регистрация: 20.8.2003

Репутация: нет
Всего: 4



PM MAIL   Вверх
nicka
Дата 12.11.2003, 12:15 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Опытный
**


Профиль
Группа: Участник
Сообщений: 378
Регистрация: 11.6.2003

Репутация: нет
Всего: 1



Цитата
On the Tools menu, click References.
In the References box, click to select OLE/Messaging 1.0 Object Library, and then click OK.

NOTE: If this object library is not available in the References list, click Browse, and then search your Windows\System folder for the file Mdisp32.tlb.


Но у меня на машине нет Mdisp32.tlb, соответственно код не работает. Где его достать!!!

PM MAIL   Вверх
Alexei
Дата 12.11.2003, 16:08 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Опытный
**


Профиль
Группа: Участник
Сообщений: 382
Регистрация: 20.8.2003

Репутация: нет
Всего: 4



Попробуй Аутлук:
http://msdn.microsoft.com/library/default....sdn_movs105.asp
, а еще набери в поиске: MAPI

PM MAIL   Вверх
cardinal
Дата 12.11.2003, 17:42 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Инженер
****


Профиль
Группа: Экс. модератор
Сообщений: 6003
Регистрация: 26.3.2002
Где: Германия

Репутация: 19
Всего: 99



Читайте здесь. А вообще вот самое важное из всего этого. В принципе принцип ясен, попробуй может подойдет.

I want to write a program that my customers can click a button and send me a copy of their database (for backup or troubleshooting).

Most of them use AOL, and all I can find is code for using Outlook.

*********************************
Код
Function Send_OutlookMsg() As Long
  Dim appOutlookApp As Object
  Dim nsNameSpace As Object
  Dim maiMail As Object

  Set appOutlookApp = CreateObject("Outlook.Application")
  Set nsNameSpace = appOutlookApp.GetNamespace("MAPI")
  Set maiMail = appOutlookApp.CreateItem(0)
   
  With maiMail
       .Subject = CStr(Me!txtSubject)
       .Body = CStr(Me!txtBodyText)
       .Attachments.Add CStr(Me!txtObject)
       .Recipients.Add CStr(Me!txtEmailAddress)
       .Send
  End With

  Send_OutlookMsg = 0
  Set maiMail = Nothing
  Set appOutlookApp = Nothing
  Set nsNameSpace = Nothing
End Function

*************************************

What is the syntax (and/or other requirements) for sending email from Access through the AOL mail system?

AOL's e-mail system is very much proprietary. And they seem to be tight-lipped as far as how one would write utilities to interface with it.

Once upon a yester-year, they had something of a SDK for their system (not just e-mail). But because of a problem of abuse by some (who used it to knock people off-line, steal user's passwords and credit card info, etc), they seem to want to keep that knowledge private.

The only option you'd have, to my knowledge, would be to write a module which would launch AOL (after you've located where the user installed it) and then take control of it by sending messages to the program to cause the mail window to show up, set the text in the mail window, etc. Essentially mimicking user activity as if the user was doing all of this manually.

You'd then would likely need to account for the different versions of AOL your customers may have. You may have to vary your programatic interaction with the AOL program, depending on the AOL version you're working with.

You'd have to use various Windows API functions in order to accomplish this.

It would not be a simple task at all.

this may help

PSS ID Number: Q161833
Article last modified on 11-21-1997

WINDOWS:4.0

WINDOWS


======================================================================
----------------------------------------------------------------------
The information in this article applies to:

- Standard, Professional, and Enterprise Editions of Microsoft Visual
Basic, 16-bit and 32-bit, for Windows, version 4.0
----------------------------------------------------------------------

SUMMARY
=======

This article outlines the steps necessary to programmatically send an
e-mail message from Visual Basic using the OLE Messaging Library. This
example assumes that the OLE Messaging Library was properly installed on
your computer (typically, by installing Exchange).

The sample code can also be used from VBA, allowing Access, Excel, or
Project to send e-mail via the OLE Messaging Library.

MORE INFORMATION
================

With the OLE Messaging Library, you can quickly and easily add e-mail
capabilities (that is, sending and receiving e-mail messages, and
interacting with folders and address books) to your Visual Basic
application. You can create programmable messaging objects, and then use
their properties and methods to meet the needs of your application.

The objects and methods exposed by the OLE Messaging Library are much more
robust than the MAPI controls that ship with Visual Basic, thus allowing
access to many MAPI properties that the MSMAPI OCX controls simply do not
address.

"Microsoft OLE Messaging Library Programmers Reference" is available in the
Microsoft Developer Network (MSDN), or the Olemsg.hlp file that installs
with Exchange Forms Designer 4.0.

NOTE: If this object library is not available in the References list, click
the Browse button and search your Windows\System folder for the file
Mdisp32.tlb.

Sample Code
-----------

To build a Visual Basic project that sends a simple message, follow
these steps:

1. Open a new project in Visual Basic.

2. On the Tools menu, click References. Select "OLE/Messaging 1.0 Object
Library."

3. Add a CommandButton to the default form. Accept the default name,
Command1.

4. Copy the following code into the General Declarations section of the
default form:

Код

    Option Explicit

    Private Sub Command1_Click()
      Dim objSession As Object
      Dim objMessage As Object
      Dim objRecipient As Object

      'Create the Session Object
      Set objSession = CreateObject("mapi.session")

      'Logon using the session object
      'Specify a valid profile name if you want to
      'Avoid the logon dialog box
      objSession.Logon profileName:="MS Exchange Settings"

      'Add a new message object to the OutBox
      Set objMessage = objSession.Outbox.Messages.Add

      'Set the properties of the message object
      objMessage.subject = "This is a test."
      objMessage.Text = "This is the message text."

      'Add a recipient object to the objMessage.Recipients collection
      Set objRecipient = objMessage.Recipients.Add

      'Set the properties of the recipient object
      objRecipient.Name = "John Doe"  '<---Replace this with a valid
                                      'display name or e-mail alias
      objRecipient.Type = mapiTo
      objRecipient.Resolve

      'Send the message
      objMessage.Send showDialog:=False
      MsgBox "Message sent successfully!"

      'Logoff using the session object
      objSession.Logoff
    End Sub

5. Run the project. Click Command1. You have sent e-mail from Visual Basic.

REFERENCES
==========

Microsoft OLE Messaging Library Programmers Reference

For additional information about Collaboration Data Objects versus Active
Messaging, please see the following article in the Microsoft Knowledge
Base:

ARTICLE-ID: Q176916
TITLE : INFO: Active Messaging and Collaboration Data Objects (CDO)
======================================================================
Keywords : kbprg ActMsg OLEMSG vbwin
Technology : kbole kbvba
Version : WINDOWS:4.0
Platform : WINDOWS
Issue type : kbhowto
======================================================================
Copyright Microsoft Corporation 1997.

>What is the syntax (and/or other requirements)
>for sending email from Access through the AOL
>mail system?

AOL's e-mail system is very much proprietary. And they seem to be tight-lipped as far as how one would write utilities to interface with it.

Once upon a yester-year, they had something of a SDK for their system (not just e-mail). But because of a problem of abuse by some (who used it to knock people off-line, steal user's passwords and credit card info, etc), they seem to want to keep that knowledge private.

The only option you'd have, to my knowledge, would be to write a module which would launch AOL (after you've located where the user installed it) and then take control of it by sending messages to the program to cause the mail window to show up, set the text in the mail window, etc. Essentially mimicking user activity as if the user was doing all of this manually.

You'd then would likely need to account for the different versions of AOL your customers may have. You may have to vary your programatic interaction with the AOL program, depending on the AOL version you're working with.

You'd have to use various Windows API functions in order to accomplish this.

It would not be a simple task at all.

**********************************

this may help


PSS ID Number: Q161833
Article last modified on 11-21-1997

WINDOWS:4.0

WINDOWS


======================================================================
----------------------------------------------------------------------
The information in this article applies to:

- Standard, Professional, and Enterprise Editions of Microsoft Visual
Basic, 16-bit and 32-bit, for Windows, version 4.0
----------------------------------------------------------------------

SUMMARY
=======

This article outlines the steps necessary to programmatically send an
e-mail message from Visual Basic using the OLE Messaging Library. This
example assumes that the OLE Messaging Library was properly installed on
your computer (typically, by installing Exchange).

The sample code can also be used from VBA, allowing Access, Excel, or
Project to send e-mail via the OLE Messaging Library.

MORE INFORMATION
================

With the OLE Messaging Library, you can quickly and easily add e-mail
capabilities (that is, sending and receiving e-mail messages, and
interacting with folders and address books) to your Visual Basic
application. You can create programmable messaging objects, and then use
their properties and methods to meet the needs of your application.

The objects and methods exposed by the OLE Messaging Library are much more
robust than the MAPI controls that ship with Visual Basic, thus allowing
access to many MAPI properties that the MSMAPI OCX controls simply do not
address.

"Microsoft OLE Messaging Library Programmers Reference" is available in the
Microsoft Developer Network (MSDN), or the Olemsg.hlp file that installs
with Exchange Forms Designer 4.0.

NOTE: If this object library is not available in the References list, click
the Browse button and search your Windows\System folder for the file
Mdisp32.tlb.

Sample Code
-----------

To build a Visual Basic project that sends a simple message, follow
these steps:

1. Open a new project in Visual Basic.

2. On the Tools menu, click References. Select "OLE/Messaging 1.0 Object
Library."

3. Add a CommandButton to the default form. Accept the default name,
Command1.

4. Copy the following code into the General Declarations section of the
default form:
Код

    Option Explicit

    Private Sub Command1_Click()
      Dim objSession As Object
      Dim objMessage As Object
      Dim objRecipient As Object

      'Create the Session Object
      Set objSession = CreateObject("mapi.session")

      'Logon using the session object
      'Specify a valid profile name if you want to
      'Avoid the logon dialog box
      objSession.Logon profileName:="MS Exchange Settings"

      'Add a new message object to the OutBox
      Set objMessage = objSession.Outbox.Messages.Add

      'Set the properties of the message object
      objMessage.subject = "This is a test."
      objMessage.Text = "This is the message text."

      'Add a recipient object to the objMessage.Recipients collection
      Set objRecipient = objMessage.Recipients.Add

      'Set the properties of the recipient object
      objRecipient.Name = "John Doe"  '<---Replace this with a valid
                                      'display name or e-mail alias
      objRecipient.Type = mapiTo
      objRecipient.Resolve

      'Send the message
      objMessage.Send showDialog:=False
      MsgBox "Message sent successfully!"

      'Logoff using the session object
      objSession.Logoff
    End Sub

5. Run the project. Click Command1. You have sent e-mail from Visual Basic.

REFERENCES
==========

Microsoft OLE Messaging Library Programmers Reference

For additional information about Collaboration Data Objects versus Active
Messaging, please see the following article in the Microsoft Knowledge
Base:

ARTICLE-ID: Q176916
TITLE : INFO: Active Messaging and Collaboration Data Objects (CDO)
======================================================================
Keywords : kbprg ActMsg OLEMSG vbwin
Technology : kbole kbvba
Version : WINDOWS:4.0
Platform : WINDOWS
Issue type : kbhowto
======================================================================
Copyright Microsoft Corporation 1997.

******************************

also here's something for Access 2, but you should be able to modify it to work with 97 it demonstrates the api MAPISendMail (however you may need to verify that it is the 32 bit syntax)

PSS ID Number: Q99403
Article last modified on 04-29-1998

1.0 1.1 2.0

WINDOWS

======================================================================
---------------------------------------------------------------------
The information in this article applies to:

- Microsoft Access versions 1.0, 1.1, 2.0
---------------------------------------------------------------------

SUMMARY
=======

Advanced: Requires expert coding, interoperability, and multiuser skills.

This article demonstrates how to use the Mail Application Programming
Interface (MAPI) in Access Basic to send a mail message from a form. You
can send mail to one or more persons using the To and CC (carbon copy)
fields in the example below.

MORE INFORMATION
================

This article assumes that you are familiar with Access Basic and with
creating Microsoft Access applications using the programming tools provided
with Microsoft Access. For more information about Access Basic, please
refer to the "Building Applications" manual.

The following procedure explains how to use this sample module:

1. Create new, unbound form with multiple controls for entering recipient
addresses and message text, for example:

Form: Test
-----------
Caption: TestForm
Text box: Subject
ControlName: Subject
Text box: To
ControlName: To
Text box: CC
ControlName: CC
Text box: Attach
ControlName: Attach
Text box: Message
ControlName: Message
Command button: Button0
Caption: Send Message
OnPush: =Mail()

NOTE: In version 2.0, the OnPush property is called the OnClick
property.

2. Create a new module and enter the following code:

NOTE: In the following sample code, an underscore (_) is used as a
line continuation character for easier reading. Remove the
underscore from the end of the line when re-creating this code in Access
Basic.
Код

'*************************************************************
  'Declarations section of the module.

'*************************************************************

  Option Explicit
  Option Compare Database   'Use database order for string comparisons

  Type MAPIMessage
     Reserved As Long
     Subject As String
     NoteText As String
     MessageType As String
     DateReceived As String
     ConversationID As String
     Flags As Long
     RecipCount As Long
     FileCount As Long
  End Type

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

  Type MapiFile
     Reserved As Long
     Flags As Long
     Position As Long
     PathName As String
     FileName As String
     FileType As String
  End Type

  Declare Function MAPISendMail Lib "MAPI.DLL" Alias "BMAPISendMail" _
  (ByVal Session&, ByVal UIParam&, Message As MAPIMessage, Recipient _
  As MapiRecip, File As MapiFile, ByVal Flags&, ByVal Reserved&) As Long

  Global Const SUCCESS_SUCCESS = 0
  Global Const MAPI_TO = 1
  Global Const MAPI_CC = 2

  Global Const MAPI_LOGON_UI = &H1

'*************************************************************
  ' End of declarations section

'*************************************************************

'*************************************************************
  ' FUNCTION NAME: Mail
  '
  ' PURPOSE:
  '   Passes information on the active forms To, Subject, CC,
  '   Attach, and Message text boxes to the SendMail function.
  '   It ensures that each box does not have a NULL value. It also
  '   displays an error message if SendMail fails.
  '   This function is called from the OnPush property of the form.
  '
  ' INPUT PARAMETERS:
  '   None
  '
  ' RETURN
  '   None

'*************************************************************
  Function Mail ()
     Dim F As Form, Result
     Set F = Screen.ActiveForm

     ' Make sure user has something in the To: box
     If IsNull(F!To) Or F!To = "" Then Exit Function

     ' Make sure no Null values are in the other boxes
     If IsNull(F!Subject) Then F!Subject = ""
     If IsNull(F!CC) Then F!CC = ""
     If IsNull(F!Attach) Then F!Attach = ""
     If IsNull(F!Message) Then F!Message = ""

     ' Send the message, passing information from the form
     Result = SendMail((F!Subject), (F!To), (F!CC),_
              (F!Attach), (F!Message))

     ' Test the result for any errors
     If Result <> SUCCESS_SUCCESS Then
        MsgBox "Error sending mail: " & Result, 16, "Mail"
     Else
        MsgBox "Message sent successfully!", 64, "Mail"
     End If
  End Function

'*************************************************************
  ' FUNCTION NAME: SendMail
  '
  ' PURPOSE:
  '   This is the front-end function to the MAPISendMail function. You
  '   pass a semicolon-delimited list of To and CC recipients, a
  '   subject, a message, and a delimited list of file attachments.
  '   This function prepares MapiRecip and MapiFile structures with the
  '   data parsed from the information provided using the ParseRecord
  '   sub. Once the structures are prepared, the MAPISendMail function
  '   is called to send the message.
  '
  ' INPUT PARAMETERS:
  '   sSubject: The text to appear in the subject line of the message
  '   sTo:      Semicolon-delimited list of names to receive the
  '             message
  '   sCC:      Semicolon-delimited list of names to be CC'd
  '   sAttach:  Semicolon-delimited list of files to attach to
  '             the message
  ' RETURN
  '   SUCCESS_SUCCESS if successful, or a MAPI error if not.

'*********************************************************** **
  Function SendMail (sSubject As String, sTo As String, sCC As String, _
                  sAttach As String, sMessage As String)
     Dim i, cTo, cCC, cAttach          ' variables holding counts
     Dim MAPI_Message As MAPIMessage

     ' Count the number of items in each piece of the mail message
     cTo = CountTokens(sTo, ";")
     cCC = CountTokens(sCC, ";")
     cAttach = CountTokens(sAttach, ";")

     ' Create arrays to store the semicolon delimited mailing
     ' .. information after it is parsed
     ReDim rTo(0 To cTo) As String
     ReDim rCC(0 To cCC) As String
     ReDim rAttach(0 To cAttach) As String

     ' Parse the semicolon delimited information into the arrays.
     ParseTokens rTo(), sTo, ";"
     ParseTokens rCC(), sCC, ";"
     ParseTokens rAttach(), sAttach, ";"

     ' Create the MAPI Recip structure to store all the To and CC
     ' .. information to be passed to the MAPISendMail function
     ReDim MAPI_Recip(0 To cTo + cCC  - 1) As MapiRecip

     ' Setup the "TO:" recipient structures
     For i = 0 To cTo - 1
        MAPI_Recip(i).Name = rTo(i)
        MAPI_Recip(i).RecipClass = MAPI_TO
     Next i

     ' Setup the "CC:" recipient structures
     For i = 0 To cCC - 1
        MAPI_Recip(cTo + i).Name = rCC(i)
        MAPI_Recip(cTo + i).RecipClass = MAPI_CC
     Next i

     ' Create the MAPI File structure to store all the file attachment
     ' .. information to be passed to the MAPISendMail function
     ReDim MAPI_File(0 To cAttach) As MapiFile

     ' Setup the file attachment structures
     MAPI_Message.FileCount = cAttach
     For i = 0 To cAttach - 1
        MAPI_File(i).Position = -1
        MAPI_File(i).PathName = rAttach(i)
     Next i

     ' Set the mail message fields
     MAPI_Message.Subject = sSubject
     MAPI_Message.NoteText = sMessage
     MAPI_Message.RecipCount = cTo + cCC

     ' Send the mail message
     SendMail = MAPISendMail(0&, 0&, MAPI_Message, MAPI_Recip(0), _
                    MAPI_File(0), MAPI_LOGON_UI, 0&)
  End Function

'*************************************************************
  ' FUNCTION NAME: CountTokens
  '
  ' PURPOSE:
  '   Given a string of delimited items and the delimiter, the number
  '   of tokens in the string will be returned. This function is useful
  '   for dimensioning an array to store the delimited items prior to
  '   calling ParseTokens.
  '
  ' INPUT PARAMETERS:
  '   sSource: A delimited list of tokens
  '   sDelim:  The delimiter used to delimit sSource
  '
  ' RETURN
  '   The number of tokens in sSource, which is the number of delimiters
  '   plus 1. If sSource is empty, 0 is returned.

'*************************************************************
  Function CountTokens (ByVal sSource As String, ByVal sDelim As String)
     Dim iDelimPos As Integer
     Dim iCount As Integer

     ' Number of tokens = 0 if the source string is empty
     If sSource = "" Then
        CountTokens = 0

     ' Otherwise number of tokens = number of delimiters + 1
     Else
        iDelimPos = InStr(1, sSource, sDelim)
        Do Until iDelimPos = 0
           iCount = iCount + 1
           iDelimPos = InStr(iDelimPos + 1, sSource, sDelim)
        Loop
        CountTokens = iCount + 1
     End If
  End Function

'*************************************************************
  ' FUNCTION NAME: GetToken
  '
  ' PURPOSE:
  '   Given a string of delimited items, the first item will be
  '   removed from the list and returned.
  '
  ' INPUT PARAMETERS:
  '   sSource: A delimited list of tokens
  '   sDelim:  The delimiter used to delimit sSource
  '
  ' RETURN
  '   sSource will have the first token removed. The function
  '   returns the token removed from sSource.

'*************************************************************
  Function GetToken (sSource As String, ByVal sDelim As String) _
  As String
     Dim iDelimPos As Integer

     ' Find the first delimiter
     iDelimPos = InStr(1, sSource, sDelim)

     ' If no delimiter was found, return the existing string and set
     ' .. the source to an empty string.
     If (iDelimPos = 0) Then
        GetToken = Trim$(sSource)
        sSource = ""

     ' Otherwise, return everything to the left of the delimiter and
     ' .. return the source string with it removed.
     Else
        GetToken = Trim$(Left$(sSource, iDelimPos - 1))
        sSource = Mid$(sSource, iDelimPos + 1)
     End If
  End Function

'*************************************************************
  ' SUB NAME: ParseTokens
  '
  ' PURPOSE:
  '   Extracts information from a delimited list of items and places
  '   it in an array.
  '
  ' INPUT PARAMETERS:
  '   Array(): A one-dimensional array of strings in which the parsed
  '   tokens will be place
  '   sTokens: A delimited list of tokens
  '   sDelim:  The delimiter used to delimit sTokens
  '
  ' RETURN
  '   None

'*************************************************************
  Sub ParseTokens (Array() As String, ByVal sTokens As String, ByVal _
                   sDelim As String)
     Dim i As Integer
     For i = LBound(Array) To UBound(Array)
        Array(i) = GetToken(sTokens, sDelim)
     Next
  End Sub

REFERENCES
==========

Microsoft Mail "Technical Reference," Chapter 4

Additional query words: mail application programming api
======================================================================
Keywords : kbinterop kbprg
Version : 1.0 1.1 2.0
Platform : WINDOWS
Hardware : x86
Issue type : kbinfo
======================================================================
Copyright Microsoft Corporation 1998.

********************************

AOL's e-mail system is not MAPI compliant. It is their own proprietary system.

That is some good reference material, though. Thanks.


--------------------
Немецкая оппозиция потребовала упростить натурализацию иммигрантов
В моем блоге: Разные истории из жизни в Германии

"Познание бесконечности требует бесконечного времени, а потому работай не работай - все едино".  А. и Б. Стругацкие
PM   Вверх
Unregistered
Дата 13.11.2003, 13:13 (ссылка)    |    (голосов: 0) Загрузка ... Загрузка ... Быстрая цитата Цитата


Unregistered











Код
Function Send_OutlookMsg() As Long
 Dim appOutlookApp As Object
 Dim nsNameSpace As Object
 Dim maiMail As Object

 Set appOutlookApp = CreateObject("Outlook.Application")
 Set nsNameSpace = appOutlookApp.GetNamespace("MAPI")
 Set maiMail = appOutlookApp.CreateItem(0)
 
 With maiMail
      .Subject = CStr(Me!txtSubject)
      .Body = CStr(Me!txtBodyText)
      .Attachments.Add CStr(Me!txtObject)
      .Recipients.Add CStr(Me!txtEmailAddress)
      .Send
 End With

 Send_OutlookMsg = 0
 Set maiMail = Nothing
 Set appOutlookApp = Nothing
 Set nsNameSpace = Nothing
End Function


Это вроде работает, только к сожалению сколько раз посылаю письмо, столько раз открываеться OUTLOOK.exe, так что при например выключении компъютера начинаються процессы их аварийного закрытия в итоге машина не хочет выключаться,
Вроде Set maiMail = Nothing должно закрывать объект?
Из-за чего это и Что можно сделать?
  Вверх
cardinal
Дата 13.11.2003, 18:12 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Инженер
****


Профиль
Группа: Экс. модератор
Сообщений: 6003
Регистрация: 26.3.2002
Где: Германия

Репутация: 19
Всего: 99



Цитата
Это вроде работает, только к сожалению сколько раз посылаю письмо, столько раз открываеться OUTLOOK.exe

А у меня этого не наблюдается. OUTLOOK.exe вообще не запускается, а письма просто попадают в папку "исходящие" в Microsoft Outlook.


--------------------
Немецкая оппозиция потребовала упростить натурализацию иммигрантов
В моем блоге: Разные истории из жизни в Германии

"Познание бесконечности требует бесконечного времени, а потому работай не работай - все едино".  А. и Б. Стругацкие
PM   Вверх
  
Ответ в темуСоздание новой темы Создание опроса
Правила форума "VB6"
Akina

Запрещается!

1. Публиковать ссылки на вскрытые компоненты

2. Обсуждать взлом компонентов и делиться вскрытыми компонентами

  • Литературу по VB обсуждаем здесь
  • Действия модераторов можно обсудить здесь
  • С просьбами о написании курсовой, реферата и т.п. обращаться сюда
  • Вопросы по реализации алгоритмов рассматриваются здесь
  • Используйте теги [code=vb][/code] для подсветки кода. Используйтe чекбокс "транслит" (возле кнопок кодов) если у Вас нет русских шрифтов.


Если Вам понравилась атмосфера форума, заходите к нам чаще! С уважением, Akina.

 
0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей)
0 Пользователей:
« Предыдущая тема | VB6 | Следующая тема »


 




[ Время генерации скрипта: 0.0833 ]   [ Использовано запросов: 22 ]   [ GZIP включён ]


Реклама на сайте     Информационное спонсорство

 
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности     Powered by Invision Power Board(R) 1.3 © 2003  IPS, Inc.