Results 1 to 7 of 7
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VERIFY user in Echenge e mail server (2000)

    I use this code to send a wbook...
    But before to send email with .send is possoble to verify if user existis in user account of exchange?(MATRICOLA is the var filled with user)
    code:
    Sub INVIO_SOSPESI_LOOP(TIPOLOGIA_MERCATO, MATRICOLA, INDICE)

    Dim TESTO As String
    Dim OutApp As Object
    Dim OutMail As Object
    Dim TEMPNAME As String, TEMPNAME1 As String, STRDIR As String
    Dim DATA As Date
    Dim DRIVER As String, DATA_SALVA As String
    Dim GIORNO As String, MESE As String, ANNO As String, CURFILE As String

    Application.ScreenUpdating = False
    Application.EnableEvents = False

    DRIVER = "GCD01F4500DATIPUBBLICAAPPLICAZIONI"
    'DA QUI OPRENDE IL FILE DI .DOC
    STRDIR = "GCD01F4500DATIPUBBLICAAPPLICAZIONIZIP_FILE"
    CURFILE = Dir(STRDIR & "*.DOC")
    'DA QUI OPRENDE IL FILE DI .DOC

    Set OutApp = CreateObject("Outlook.Application")
    OutApp.Session.Logon
    Set OutMail = OutApp.CreateItem(0)

    DATA = Format(CDate((Now)), "MM/DD/YYYY")
    GIORNO = Left(DATA, 2)
    MESE = Mid(DATA, 4, 2)
    ANNO = Right(DATA, 4)
    DATA_SALVA = GIORNO & "-" & MESE & "-" & ANNO

    TEMPNAME = DRIVER & "ANT_FATT" & ActiveWorkbook.Name
    TEMPNAME1 = STRDIR & "" & CURFILE

    Application.DisplayAlerts = False
    ActiveWorkbook.SaveAs TEMPNAME
    ActiveWorkbook.Close
    Application.DisplayAlerts = True

    On Error Resume Next

    With OutMail

    If MATRICOLA = "MATRICOLA INESISTENTE" Then
    .To = ""
    Else
    .To = MATRICOLA
    End If

    Call TROVA_MATRICOLE_PER_CC(MATRICOLA)
    If TIPOLOGIA_MERCATO = "CLIENTELA RETAIL" Then
    .CC = VAR_AGE_PER
    Else
    .CC = ""
    End If

    .BCC = ""

    If TIPOLOGIA_MERCATO = "CORPORATE" Or TIPOLOGIA_MERCATO = "PUBBLICA AMMINISTRAZIONE" Then
    .Subject = "TIPO MERCATO: " & TIPOLOGIA_MERCATO & " - FILIALE AREA: " & INDICE & " - REPORT FATTURE SCADUTE - " & Format(CDate(Now), "DD/MM/YYYY")
    End If

    If TIPOLOGIA_MERCATO = "CLIENTELA RETAIL" Or TIPOLOGIA_MERCATO = "CLIENTELA RESIDUALE" Then
    .Subject = "TIPO MERCATO: " & TIPOLOGIA_MERCATO & " - AREA: " & INDICE & " - REPORT FATTURE SCADUTE - " & Format(CDate(Now), "DD/MM/YYYY")
    End If

    .Body = TESTO & vbCrLf & vbCrLf
    .Attachments.Add TEMPNAME
    .Attachments.Add TEMPNAME1

    If MATRICOLA = "MATRICOLA INESISTENTE" Then
    .Display
    Else
    '.Display
    .Send
    End If

    End With

    On Error GoTo 0

    Set OutMail = Nothing
    Set OutApp = Nothing

    Application.EnableEvents = True
    Application.ScreenUpdating = True

    End Sub

  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: VERIFY user in Echenge e mail server (2000)

    Examine the myRecipient.Resolve and .Recipients.ResolveAll Methods in Outlook, create a handler if the .Resolve or .ResolveAll returns False, or use the myRecipient.Resolved Method to handle failure.
    -John ... I float in liquid gardens
    UTC -7ąDS

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VERIFY user in Echenge e mail server (2000)

    not completly understand...
    pearphs:

    if .resolveall =true then
    user ok found
    else
    user not found
    end if

    if the code is ok where i put unstruction.... before .send
    ???

  4. #4
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: VERIFY user in Echenge e mail server (2000)

    Instead of using using "outmail.To", use something like this untested aircode (translation and error handling is up to you, and MATRICOLA is not Dim'd so I assume it's a single recipient);

    With outmail
    Set myRecipient = .Recipients.Add(MATRICOLA)
    If not myRecipient.Resolve Then
    MsgBox MATRICOLA & " non trovato"
    ' your choice of handling this error here
    End If
    End With
    -John ... I float in liquid gardens
    UTC -7ąDS

  5. #5
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VERIFY user in Echenge e mail server (2000)

    ok...

    but how to dim myRecipient?

  6. #6
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: VERIFY user in Echenge e mail server (2000)

    As an Object.
    -John ... I float in liquid gardens
    UTC -7ąDS

  7. #7
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VERIFY user in Echenge e mail server (2000)

    John many tks, resolved a very big pro...
    Pizza for you from Napoli!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •