Eu tenho esse código abaixo. Salve o email com todos os recibos, mas ele só envia para o primeiro recibo;
Na pasta enviada do Lotus - > [email protected]; [email protected]
No final da recepção - > [email protected]; teste
O código é:
primeiro! [E-mail] - > test @ test.com, test @ test2.com
Pode ser 1, 2 ou mais;
Private Sub Command43_Click()
Dim rst As DAO.Recordset
Dim strBody
Dim Sendto1, Esubject As String
Dim Session As Object
Dim EmbedObj1 As Object
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("L:\DOCS.txt", ForReading)
strBody = f.ReadAll
f.Close
Set rst = Form_PD_S_Docs.RecordsetClone
While Not rst.EOF
Sendto1 = rst![Email]
Esubject = "Teste" & " " & rst![SAP] & " " & rst![Nome]
SendEmail Sendto1, Esubject, strBody2
rst.MoveNext
Wend
End Sub
----- / ------
Public Sub SendEmail(ByVal pvTo, ByVal pvSubj, ByVal pvBody)
Dim Session As Object
Dim EmbedObj1 As Object
On Error GoTo errorhandler1
Set Session = CreateObject("Notes.NotesSession")
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, "
"))) & ".nsf"
Set Maildb = Session.GetDatabase("", MailDbName)
If Maildb.IsOpen = True Then
Else
Maildb.OPENMAIL
End If
Set MailDoc = Maildb.CreateDocument
MailDoc.Form = "Memo"
With MailDoc
.SendTo = pvTo
.Subject = pvSubj
.Body = pvBody
.PostedDate = Now()
.SaveMessageOnSend = True
.Send 0, pvTo
End With
endit:
Set Maildb = Nothing
Set MailDoc = Nothing
Set AttachME = Nothing
Set Session = Nothing
Set EmbedObj1 = Nothing
Exit Sub
errorhandler1:
MsgBox Err.Description, , Err
Resume endit
End Sub