Avatar billede accesspro Nybegynder
14. april 2002 - 13:40 Der er 34 kommentarer og
1 løsning

Sende email til Outlook 2002

Hej,
Jeg har et problem jeg sender emails via mit access systeme men i Outlook 2002 som har fået nogle nogle  security fetures kommer den op med en prompt, om at et andet program er ved at sende en email og om jeg vil tillade dette. Problemet er at det staler mit program totalt

Her beskrives problem, men de kommer kun med en løsning hvis man sidder i et Exchange server miljø. Er der nogen der kan hjælpe mig med mit problem..

DET HASTER!!!!!
http://support.microsoft.com/default.aspx?scid=kb;DA;q290498
Avatar billede terry Ekspert
14. april 2002 - 13:56 #1
can you send the dB to me and I will try it here? terry@santhell.dk
Avatar billede accesspro Nybegynder
14. april 2002 - 14:04 #2
i have sent it...thanx
14. april 2002 - 14:04 #3
Hej Robert,

Jeg har selv spekuleret lidt over det - og kan kun komme frem til at man i hvert fald kan bruge sendkeys i nogle tilfælde.

Det afhænger lidt af hvordan du sender mailen. Det mest effektive (i denne problematik) er at bruge Docmd.Sendobject

Nedenstående virker:

    SendKeys "{LEFT}", False
    SendKeys "{ENTER}", False
    DoCmd.SendObject acSendNoObject, "", acFormatRTF, "mail@adresse.dk", , , "Test", "Test af Outlook 2002", True


Hvis du bruger den mere avancerede model, hvor du bruger Outlook.Application og .CreateItem(olMailItem), så er det et spørgsmål om at sætte de 2 Sendkeys-sætninger ind de strategisk rigtige steder i koden. (Formentlig flere steder afhængig af hvordan din kode er bygget op og hvor mange gange Access skal have fat i Outlook-objektet for at kunne sende mailen

/Thomas :o)
Avatar billede accesspro Nybegynder
14. april 2002 - 14:36 #4
Jeg kan ikke få det til at virker....problemet er at det tager Outlook nogle sekunder at køre denne process....det er ikke en almindelig prompt.....den stå og tænker lidt over det før den frigiver yes knappen.
Avatar billede terry Ekspert
14. april 2002 - 14:43 #5
yes 5 second!
14. april 2002 - 14:49 #6
ikke på min...

hvad hvis du bruger true i stedet?
Avatar billede terry Ekspert
14. april 2002 - 14:58 #7
Thomas>This is sending mail via Outlook, what are you using?
Avatar billede accesspro Nybegynder
14. april 2002 - 14:58 #8
sådan ser det ud hos mig....Problemet er også hvis jeg sneder mere end en mail så gør den det for hver mail....

Sub SendEmail()

  Dim MyOlApp As Object
  Dim myItem As Variant
  Dim EmailAddr As String
  Dim AttachPath As String
  Dim CCmail As String
  Dim txt1 As String
  Dim i As Integer


  Set dbsKKA = CurrentDb()
  Set rstOutbox = dbsKKA.OpenRecordset("tbl_outbox_send", _
      dbOpenDynaset)

   
  With rstOutbox
      Do Until .EOF
        Set MyOlApp = CreateObject("Outlook.Application")
        Set myItem = MyOlApp.CreateItem(olMailItem)

        EmailAddr = rstOutbox![Mail]
        myItem.To = EmailAddr

        If Not IsNull(rstOutbox![CCmail]) Then
            CCmail = rstOutbox![CCmail]
            myItem.Cc = CCmail
        End If

        If Not IsNull(rstOutbox![Attachment]) Then
          AttachPath = rstOutbox![Attachment]
            myItem.Attachments.Add (AttachPath)
        End If

        myItem.Subject = rstOutbox![Subject]
        myItem.Body = rstOutbox![Text]

        myItem.Send
           
        SendKeys "{LEFT}", True
        SendKeys "{ENTER}", True
       
        Set myItem = Nothing
        Set MyOlApp = Nothing
         

 
        .MoveNext
      Loop
  End With


  rstOutbox.Close
End Sub
Avatar billede accesspro Nybegynder
14. april 2002 - 14:59 #9
Jeg er nød til at have det diabled.....
14. april 2002 - 15:07 #10
den bør vel se således ud (Sendkeys skal stå før)
Sub SendEmail()

  Dim MyOlApp As Object
  Dim myItem As Variant
  Dim EmailAddr As String
  Dim AttachPath As String
  Dim CCmail As String
  Dim txt1 As String
  Dim i As Integer


  Set dbsKKA = CurrentDb()
  Set rstOutbox = dbsKKA.OpenRecordset("tbl_outbox_send", _
      dbOpenDynaset)

   
  With rstOutbox
      Do Until .EOF
        Set MyOlApp = CreateObject("Outlook.Application")
        Set myItem = MyOlApp.CreateItem(olMailItem)

        EmailAddr = rstOutbox![Mail]
        myItem.To = EmailAddr

        If Not IsNull(rstOutbox![CCmail]) Then
            CCmail = rstOutbox![CCmail]
            myItem.Cc = CCmail
        End If

        If Not IsNull(rstOutbox![Attachment]) Then
          AttachPath = rstOutbox![Attachment]
            myItem.Attachments.Add (AttachPath)
        End If

        myItem.Subject = rstOutbox![Subject]
        myItem.Body = rstOutbox![Text]

        SendKeys "{LEFT}", false
        SendKeys "{ENTER}", false

        myItem.Send
                 
        Set myItem = Nothing
        Set MyOlApp = Nothing
         

 
        .MoveNext
      Loop
  End With
Avatar billede terry Ekspert
14. april 2002 - 15:13 #11
Either way I get the same message!

Robert,  I have had a look arround but dont seem to find a solution at the moment! At work I have Premier Support for Access with Microsoft, I could contact them to see if there is a solution.

I would imagin  that having a PAUSE for about 5-6 seconds and then sendkeys .. could maybe do the trick but I dont think that is the right way!
Avatar billede terry Ekspert
14. april 2002 - 15:15 #12
Thomas>What do the sendkeys do?
14. april 2002 - 15:17 #13
Sends keys ;o)

Denne funktion pauser i et antal millisekunder:

Private Declare Sub sapiSleep Lib "kernel32" _
        Alias "Sleep" _
        (ByVal dwMilliseconds As Long)

Sub Wait(lngMilliSec As Long)
    If lngMilliSec > 0 Then
        Call sapiSleep(lngMilliSec)
    End If
End Sub

Sub sTestSleep()
Const cTIME = 1000 'in MilliSeconds
    Call Wait(cTIME)
    MsgBox "Before this Msgbox, I was asleep for " _
        & cTIME & " Milliseconds."
End Sub
Avatar billede accesspro Nybegynder
14. april 2002 - 15:19 #14
Yes
Either way I still get the message.....thanx that would be great....
14. april 2002 - 15:19 #15
sendkeys sends keystrokes to Windows
14. april 2002 - 15:20 #16
gotta go now, but will be back tonight again....
Avatar billede terry Ekspert
14. april 2002 - 15:24 #17
Yes I know Sendkeys did that too, but I just couldnt see how it would help here!
Avatar billede accesspro Nybegynder
14. april 2002 - 15:36 #18
I think that he ment that Access should click the Yes button automatically.
Avatar billede terry Ekspert
14. april 2002 - 16:00 #19
Have you tried to pause before sendkeys?
Avatar billede accesspro Nybegynder
14. april 2002 - 16:29 #20
Well I will try.
Avatar billede accesspro Nybegynder
14. april 2002 - 16:43 #21
It is as if it does not move on to the pause and sendkeys code before the yes button is pressed....???Because nothing happens. If i presse yes...the code moves on.???
Avatar billede accesspro Nybegynder
14. april 2002 - 17:23 #22
The sendkeys are not sent until I click yes....no code is beeing procesed before I have press the Yes button.
Avatar billede terry Ekspert
14. april 2002 - 17:37 #23
But I thought you were having a broblem BECAUSE the code continued even before Yes was pressed "Problemet er at det staler mit program totalt"!
So in fact the only problem is that your program stops UNTIL you answer. Does that cause problems in your program?
Avatar billede accesspro Nybegynder
14. april 2002 - 19:21 #24
yes because, I have a enco off running, because it is doing all these this...and beside that It is annoying that you have to go in to Outlook and press yes....the whole  point is that it should run automatically...
Avatar billede terry Ekspert
14. april 2002 - 19:41 #25
Yes I agree, it is VERY annoying! Hopefully MS can make some suggestions. Will get back when I get an answer from them!
15. april 2002 - 10:51 #26
Efter at have gransket MSDN godt og grundigt gennem, er jeg egentlig kommet til den konklussion, at det IKKE er muligt styre fra Access. Hvis der var en workaround, hvor er sikkerheden så henne?

Faktisk tror jeg at det netop er derfor der er en 5 sekunders delay på: så man IKKE kan bruge sendkeys og andet crap.

Derimod kan man muligvis komme lidt videre med at give sit VBA-projekt en Digital Signatur, som man så kan give tilladelse/adgang fra outlook.
Jeg har dog ikke fået det til at virke. Men følgende links skriver lidt om det:
http://search.microsoft.com/gomsuri.asp?n=2&c=rp_Results&siteid=us/dev&target=http://msdn.microsoft.com/library/en-us/dnout2k/html/oldigitalsignature.asp
og
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odeopg/html/deovrsigningvbaproject.asp

Either way, there is no easy workaround!

Jeg tror, at vi bevæger os ind i en tid, hvor folk bare må indstille sig på at der er nogle ekstra sikkerhedsforanstaltninger, som må tages i det daglige. Heriblandt at man skal bekræfte afsendelse af mails.

Det er selvfølgelig noget rigtig skidt, hvis man skal sende 1000 mails :o(
Avatar billede terry Ekspert
15. april 2002 - 11:14 #27
Hi Thomas>I agree with "Hvis der var en workaround, hvor er sikkerheden så henne?" It is obviously there for a reason, but as you say yourself "Det er selvfølgelig noget rigtig skidt, hvis man skal sende 1000 mails"!

Anyway I have contacted MS so lets see if we can get some help from them!
Avatar billede terry Ekspert
15. april 2002 - 14:20 #28
This is what I received from MS. Q290500 suggests the following solutions

“Use the administrator features to disable object model restrictions, or convert your Visual Basic for Applications code to a COM Add-in, and then register it by using the administrator form.”


OL2002: Developer Information About E-Mail Security Features (Q290500)
http://support.microsoft.com/default.aspx?scid=kb;SV;q290500
OL2002: Questions About Custom Forms and Outlook Solutions (Q287530)
http://support.microsoft.com/default.aspx?scid=kb;SV;q287530
Avatar billede terry Ekspert
17. april 2002 - 18:38 #29
accesspro>Have you seen the answer from MS?
Avatar billede accesspro Nybegynder
17. april 2002 - 19:39 #30
Dear Terry,

My name is Robert....yes, i have seen it, but i had already read it I have however and other link you might think was interesting http://www.slipstick.com/outlook/esecup.htm#autosec

I have shown it to Thomas also.
Avatar billede terry Ekspert
17. april 2002 - 20:09 #31
Hi Robert
Well MS actually suggest that a COM add-in be made. The Redemption COM add-in looks like th ebest solution, but if your intending to use it for business purposes then $200 sound a bit much!

Maybe have to try to make one myself :o)
Avatar billede accesspro Nybegynder
17. april 2002 - 20:25 #32
Can you do that.....
Avatar billede terry Ekspert
17. april 2002 - 20:31 #33
Never tried but I would think I could given the time!
Avatar billede accesspro Nybegynder
17. april 2002 - 20:43 #34
OK...let me know....
Avatar billede accesspro Nybegynder
15. oktober 2002 - 08:09 #35
trukket tilbage
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Dyk ned i databasernes verden på et af vores praksisnære Access-kurser

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester