PDA

View Full Version : Solved: More than one



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

Killian
08-16-2006, 07:59 AM
you can loopmailitem.Recipients.Add namefor each name you want to add

gsouza
08-16-2006, 08:35 AM
Does not seem to work, maybe I am not putting it in the right place. Can you show me where in the code to stick it. Thanks

gsouza
08-16-2006, 08:53 AM
Thank you, I figured it out with you help of course. Thanks again

Zack Barresse
08-16-2006, 09:56 AM
gsouza, don't forget to mark your thread as solved. I have marked it for you. You can do so in the future by going to Thread Tools | Mark Thread Solved | Perform Action.