Consulting

Results 1 to 5 of 5

Thread: Solved: More than one

  1. #1
    VBAX Contributor
    Joined
    Dec 2004
    Posts
    122
    Location

    Solved: More than one

    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.


    [vba]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
    [/vba]

  2. #2
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    you can loop[VBA]mailitem.Recipients.Add name[/VBA]for each name you want to add
    K :-)

  3. #3
    VBAX Contributor
    Joined
    Dec 2004
    Posts
    122
    Location
    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

  4. #4
    VBAX Contributor
    Joined
    Dec 2004
    Posts
    122
    Location
    Thank you, I figured it out with you help of course. Thanks again

  5. #5
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •