Helpmij.nl
Helpmij.nl
Helpmij.nl
Steun Helpmij.nl! Klik hier     Computerprobleem? Klik hier!

Quote

Weergeven resultaten 1 tot 9 van 9

Onderwerp: mail verzenden vanuit Drafts

  1. #1
    Vraag is opgelost

    mail verzenden vanuit Drafts

    Wanneer ik onderstaande uitvoer in Outlook, krijg ik steeds foutmelding, terwijl ik niets wijzigde en het oorspronkelijk wel alle mails uit "Drafts" verstuurde.

    'Declare Sleep API
    Private Declare Sub Sleep Lib "kernel32" (ByVal nMilliseconds As Long)

    Sub SendAllDrafts()
    ' Send the messages in the Drafts folder (ignore any subfolders)
    If MsgBox("Are you sure you want to send ALL the items in * Drafts folder?", _
    vbQuestion + vbYesNo) <> vbYes Then Exit Sub

    Dim fldDraft As MAPIFolder
    Dim msg As Outlook.MailItem
    Dim intCount As Integer

    Set fldDraft = Outlook.Application.Folders("Drafts")

    intCount = 0
    Do While fldDraft.Items.Count > 0
    Set msg = fldDraft.Items(1)
    msg.Send
    Sleep 500
    intCount = intCount + 1
    Loop
    If Not (msg Is Nothing) Then Set msg = Nothing
    Set fldDraft = Nothing
    MsgBox intCount & " messages sent", vbInformation + vbOKOnly
    End Sub

  2. #2
    Tera Honourable Senior Member edmoor's avatar
    Geregistreerd
    8 september 2000
    Locatie
    Zuid-Holland
    Misschien handig om ook even de betreffende foutmelding erbij te vermelden.
    "It's hardware that makes a machine fast. It's software that makes a fast machine slow. "
    Op rechtstreekse vragen via email of privébericht reageer ik niet. Daar is het forum voor.
    Lees ook: http://www.helpmij.nl/forum/announcement.php?f=5

  3. #3
    Foutboodschap: Run-time error '-2147024809(80070057)': Could not complete the operation. One or more parameter values are not valid.

    Hierbij correcte gebruikte macro:
    'Declare Sleep API
    Private Declare Sub Sleep Lib "kernel32" (ByVal nMilliseconds As Long)

    Sub SendAllDrafts()
    ' Send the messages in the Drafts folder (ignore any subfolders)
    If MsgBox("Are you sure you want to send ALL the items in * Drafts folder?", _
    vbQuestion + vbYesNo) <> vbYes Then Exit Sub

    Dim fldDraft As MAPIFolder
    Dim msg As Outlook.MailItem
    Dim intCount As Integer

    Set fldDraft = Outlook.GetNamespace("Drafts").Folder

    intCount = 0
    Do While fldDraft.Items.Count > 0
    Set msg = fldDraft.Items(1)
    msg.Send
    Sleep 500
    intCount = intCount + 1
    Loop
    If Not (msg Is Nothing) Then Set msg = Nothing
    Set fldDraft = Nothing
    MsgBox intCount & " messages sent", vbInformation + vbOKOnly
    End Sub

  4. #4
    Tera Honourable Senior Member edmoor's avatar
    Geregistreerd
    8 september 2000
    Locatie
    Zuid-Holland
    En op welke regel krijg je die melding dan?
    Heb je wel een 32-bit installatie van Office?
    In een 64-bit Office zal het fout gaan op het op deze manier gebruiken van "kernel32".

    Overigens doet deze het prima:
    Code:
    Sub SendAllDraftEmails()
    
      Dim objDrafts As Outlook.Items
      Dim objDraft As Object
      Dim strPrompt As String
      Dim nResponse As Integer
      Dim i As Long
      Dim merror As Integer, Gcount As Integer
    
      On Error GoTo err_handle
    
      Set objDrafts = Outlook.Application.Session.GetDefaultFolder(olFolderDrafts).Items
      Gcount = objDrafts.Count
    
      If objDrafts.Count > 0 Then
          strPrompt = "Are you sure you want to send out all the drafts?"
          nResponse = MsgBox(strPrompt, vbQuestion + vbYesNo, "Confirm Sending")
    
          If nResponse = vbYes Then
                For i = objDrafts.Count To 1 Step -1
                      objDrafts.item(i).Send
    
                      ' **** USE ONLY ON LARGE BATCHES OF (say) 500+ emails if you need to slow the program speed down ****
                      ' **** this next line will PAUSE the program for 2 seconds before sending the NEXT Draft email **
    
                       ' **** TO USE THE PROGRAM LINE REMOVE THE SINGLE QUOTE ' IN FRONT OF 'SLEEP 2000 ****
                      ' Sleep 2000
                 Next
          End If
    
          If merror > 0 And merror = Gcount Then
                 MsgBox "No Draft Emails Sent!", vbCritical, "Email Sending Errors!"
          ElseIf merror > 0 And merror < Gcount Then
                 MsgBox "Some Draft Emails were sent - " & Trim(Str(merror)) & " emails were not sent", vbCritical, "Email Sending Errors!"
          Else
                 MsgBox "All Draft Emails Sent!", vbInformation, "Email Sending"
          End If
      Else
          MsgBox "No Draft Emails Found!", vbExclamation, "No Draft Emails Found"
      End If
    
      Exit Sub
    
    err_handle:
    
      If Err = "-2147467259" Then
          MsgBox "There must be at least one email address or contact group in the TO, CC or BCC fields" & vbCrLf & "Fix it and re-run your emails", vbExclamation, "Error in Email Address!"
          merror = 1 + merror
          Resume Next
      End If
    
    End Sub
    Laatst aangepast door edmoor : 24 juni 2019 om 12:18
    "It's hardware that makes a machine fast. It's software that makes a fast machine slow. "
    Op rechtstreekse vragen via email of privébericht reageer ik niet. Daar is het forum voor.
    Lees ook: http://www.helpmij.nl/forum/announcement.php?f=5

  5. #5
    op deze lijn geeft hij de foutmelding:

    Set fldDraft = Outlook.GetNamespace("Drafts").Folder

  6. #6
    Tera Honourable Senior Member edmoor's avatar
    Geregistreerd
    8 september 2000
    Locatie
    Zuid-Holland
    Ik zou het stukje code gebruiken dat ik in #4 plaatste.
    Die doet het in ieder geval goed.
    "It's hardware that makes a machine fast. It's software that makes a fast machine slow. "
    Op rechtstreekse vragen via email of privébericht reageer ik niet. Daar is het forum voor.
    Lees ook: http://www.helpmij.nl/forum/announcement.php?f=5

  7. #7
    ik krijg steeds volgende foutmelding in verzending nu:

    Delivery has failed to these recipients or groups:
    Middle.office.kredieten@belins.be (INVALID:Middle.office.kredieten@belins.be)
    This message was rejected by the recipient email system. Please check the recipient's email address and try resending this message, or contact the recipient directly.





    Diagnostic information for administrators:
    Generating server: XW16LXAL0004.DVSYS.DV.BE
    IMCEAINVALID-Middle+2Eoffice+2Ekredi...2Ebe@belins.be
    Remote Server returned '550 5.1.0 RESOLVER.ADR.InvalidInSmtp; encapsulated INVALID address inside an SMTP address (IMCEAINVALID-)'
    Original message headers:
    Received: from XW16LXAL0001.DVSYS.DV.BE (10.222.77.36) by
    XW16LXAL0004.DVSYS.DV.BE (10.222.77.39) with Microsoft SMTP Server (TLS) id
    15.0.1395.4; Mon, 24 Jun 2019 13:39:23 +0200
    Received: from XW16LXAL0001.DVSYS.DV.BE ([10.222.77.36]) by
    XW16LXAL0001.DVSYS.DV.BE ([10.222.77.36]) with mapi id 15.00.1395.000; Mon,
    24 Jun 2019 13:39:23 +0200
    Content-Type: application/ms-tnef; name="winmail.dat"
    Content-Transfer-Encoding: binary
    From: =?utf-8?B?TWlkZGxlIE9mZmljZSBrcmVkaWV0ZW4vY3LDqWRpdHM=?=
    <middle.office.kredieten@belins.be>
    To: "Middle.office.kredieten@belins.be"
    <IMCEAINVALID-Middle+2Eoffice+2Ekredieten+40belins+2Ebe@belins.be>
    CC: "Middle.office.kredieten@belins.be"
    <IMCEAINVALID-Middle+2Eoffice+2Ekredieten+40belins+2Ebe@belins.be>,
    "Middle.office.kredieten@belins.be"
    <IMCEAINVALID-Middle+2Eoffice+2Ekredieten+40belins+2Ebe@belins.be>
    Subject: Saldo Jokers per +6518541
    Thread-Topic: Saldo Jokers per +6518541
    Thread-Index: AdUqgWqiazhHD/u7T9qdlkNieL035A==
    X-MS-Exchange-MessageSentRepresentingType: 1
    Date: Mon, 24 Jun 2019 13:39:15 +0200
    Message-ID: <d3fa095934b64b53b4da8dd8862283cd@XW16LXAL0001.DVSYS.DV.BE>
    Accept-Language: fr-BE, en-US
    Content-Language: en-US
    X-MS-Has-Attach:
    X-MS-TNEF-Correlator: <d3fa095934b64b53b4da8dd8862283cd@XW16LXAL0001.DVSYS.DV.BE>
    MIME-Version: 1.0
    X-MS-Exchange-Transport-FromEntityHeader: Hosted
    X-Originating-IP: [10.122.196.165]
    Return-Path: middle.office.kredieten@belins.be

  8. #8
    Tera Honourable Senior Member edmoor's avatar
    Geregistreerd
    8 september 2000
    Locatie
    Zuid-Holland
    Dit lijkt me duidelijk:
    This message was rejected by the recipient email system
    Het verzenden van de drafts gaat dus goed.
    De betreffende mail wordt echter tegengehouden door het email systeem van de ontvanger.
    "It's hardware that makes a machine fast. It's software that makes a fast machine slow. "
    Op rechtstreekse vragen via email of privébericht reageer ik niet. Daar is het forum voor.
    Lees ook: http://www.helpmij.nl/forum/announcement.php?f=5

  9. #9
    ons email systeem dus :-).

    thx EdMoor

Berichtenregels

  • U mag geen nieuwe vragen starten.
  • U mag niet reageren op berichten.
  • U mag geen bijlagen versturen.
  • U mag uw berichten niet bewerken.
  •  
Helpmij.nl
Helpmij.nl

Helpmij.nl en business

Partners
Sponsoren