Ciao ragazzi
qui sotto vi posto il code vb5 che utilizzo per inviare email ad un destinatario, vorrei sapere se, ampliando il codice o altro, ci sarebbe un modo per spedire la stessa email a piu' destinatari e inoltre come allegare piu' allegati anzichè uno solo come ho fatto io:
Codice per inviare email:
Private Sub Command1_Click()
On Error GoTo ErrorOccuring
On Error GoTo ErrorHandler
SUPEREMAIL.MAPIMessages1.Compose
SUPEREMAIL.MAPIMessages1.RecipDisplayName = txtA.Text
SUPEREMAIL.MAPIMessages1.MsgSubject = txtOggetto.Text
SUPEREMAIL.MAPIMessages1.MsgNoteText = txtTesto.Text
SUPEREMAIL.MAPIMessages1.AddressResolveUI = True
SUPEREMAIL.MAPIMessages1.ResolveName
If Attachments.ListCount <> 0 Then
SUPEREMAIL.MAPIMessages1.AttachmentPathName = Attachments.List(Attachments.ListIndex)
End If
SUPEREMAIL.MAPIMessages1.Send
Exit Sub
ErrorHandler:
MsgBox MAPIERRORS(Err.Number, Err.Description), vbExclamation, App.Title
Err.Clear
Exit Sub
ErrorOccuring:
mError.RaiseError Err.Number, Err.Source
End Sub
Codice per inserire un allegato in una combo1:
Private Sub Attachments_Click()
Dim i As Integer
On Error GoTo ErrorOccuring
On Error GoTo ErrorHandler
If Attachments.ListCount > 0 Then
MsgBox "E' possibile inviare soltanto un allegato!", vbExclamation, App.Title
Exit Sub
End If
CD.CancelError = False
CD.DialogTitle = "Selezionare l'allegato da inserire nella lista"
CD.Filter = "Tutti i Files (*.*)|*.*"
CD.FilterIndex = 0
CD.ShowOpen
If Trim$(CD.filename) = "" Then Exit Sub
For i = 0 To Attachments.ListCount
If Attachments.List(i) = CD.filename Then
MsgBox "Allegato già presente in lista!", vbExclamation, App.Title
Exit Sub
End If
Next i
Attachments.AddItem CD.filename
Attachments.ListIndex = 0
Exit Sub
ErrorHandler:
MsgBox "Errore #" & Err.Number & Chr$(13) & Err.Description, vbCritical, App.Title
Err.Clear
Exit Sub
ErrorOccuring:
mError.RaiseError Err.Number, Err.Source
Exit Sub
End Sub
Grazie mille Claudio