gsouza
08-16-2006, 07:26 AM
How do I sent to more than one Recipient? I know it must be easy but I can't do it, any help is always welcome.:)
Sub SendNotesMail()
Dim Maildb As Object, MailDoc As Object, AttachMe As Object, Session As Object
Dim UserName As String, MailDbName As String
Dim EmbedObj1 As Object
Dim name As Variant
Dim message As Variant
name = johnDoe@hotmail.com
message = "Quarantine Ticket " & Date
Subject = message
Recipient = name
Set Session = CreateObject("Notes.NotesSession")
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, _
(Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
Set Maildb = Session.GetDataBase(vbNullString, MailDbName)
If Not Maildb.IsOpen Then Maildb.OpenMail
Set MailDoc = Maildb.CreateDocument
MailDoc.Form = "Memo"
MailDoc.SendTo = name
'MailDoc1.SendTo = name1 & extension
'''MailDoc.CopyTo = "ccRecipient"
'''MailDoc.BlindCopyTo = "bccRecipient"
MailDoc.Subject = "Quarantine Ticket" 'Subject of e-mail
MailDoc.Body = message 'Text of email
Set AttachMe = MailDoc.CreateRichTextItem("Attachment")
Set EmbedObj1 = AttachMe.Embedobject(1454, vbNullString, _
"C:\Documents and Settings\es69206\Desktop\QT.xls", "Attachment") 'Attaches file to e-mail
MailDoc.SaveMessageOnSend = True
MailDoc.PostedDate = Now
On Error GoTo 1:
Call MailDoc.Send(False)
Set EmbedObj1 = Nothing: Set AttachMe = Nothing: Set MailDoc = Nothing
Set Maildb = Nothing: Set Session = Nothing
MsgBox "Mail has been sent."
Exit Sub
1: Kill "C:\Documents and Settings\es69206\Desktop\QT.xls"
MsgBox "Did not send try again"
End Sub
Sub SendNotesMail()
Dim Maildb As Object, MailDoc As Object, AttachMe As Object, Session As Object
Dim UserName As String, MailDbName As String
Dim EmbedObj1 As Object
Dim name As Variant
Dim message As Variant
name = johnDoe@hotmail.com
message = "Quarantine Ticket " & Date
Subject = message
Recipient = name
Set Session = CreateObject("Notes.NotesSession")
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, _
(Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
Set Maildb = Session.GetDataBase(vbNullString, MailDbName)
If Not Maildb.IsOpen Then Maildb.OpenMail
Set MailDoc = Maildb.CreateDocument
MailDoc.Form = "Memo"
MailDoc.SendTo = name
'MailDoc1.SendTo = name1 & extension
'''MailDoc.CopyTo = "ccRecipient"
'''MailDoc.BlindCopyTo = "bccRecipient"
MailDoc.Subject = "Quarantine Ticket" 'Subject of e-mail
MailDoc.Body = message 'Text of email
Set AttachMe = MailDoc.CreateRichTextItem("Attachment")
Set EmbedObj1 = AttachMe.Embedobject(1454, vbNullString, _
"C:\Documents and Settings\es69206\Desktop\QT.xls", "Attachment") 'Attaches file to e-mail
MailDoc.SaveMessageOnSend = True
MailDoc.PostedDate = Now
On Error GoTo 1:
Call MailDoc.Send(False)
Set EmbedObj1 = Nothing: Set AttachMe = Nothing: Set MailDoc = Nothing
Set Maildb = Nothing: Set Session = Nothing
MsgBox "Mail has been sent."
Exit Sub
1: Kill "C:\Documents and Settings\es69206\Desktop\QT.xls"
MsgBox "Did not send try again"
End Sub