venerdì 8 maggio 2015

vb6 outlook

Public Sub componiMailOutlook(destinatari As String, destinatariCC As String, destinatariBcc As String, oggettoMail As String, fileAllegati As String)
Dim OutApp As Object
Dim OutMail As Object  'sarebbe un oggetto MailItem

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

  On Error Resume Next
  With OutMail
    .display
    .To = destinatari
    If destinatariCC <> "" Then
     .cc = destinatariCC
    End If
    If destinatariBcc <> "" Then
      .BCC = destinatariBcc
    End If
    .subject = oggettoMail
    '.htmlbody = testoMail
    If fileAllegati <> "" Then
      .Attachments.Add fileAllegati
    End If
    .Readreceiptrequested = False
  End With

  On Error GoTo 0
  Set OutMail = Nothing
  Set OutApp = Nothing

End Sub

Nessun commento:

Posta un commento