jeremyryan
New member
- Local time
- Yesterday, 16:04
- Joined
- Nov 20, 2010
- Messages
- 2
Long time lurker, first time poster.
I am stumped on this. I have set up a loop to send an email to multiple recipients on the same email, to allow reply all, and it is only sending to the first two listed. Thinking there was something wrong with my loop I even manually entered the email address in the code and still no luck... The funny thing is, when I look in the sent box, it appears it sends to everyone, but only the first two receive. Anyone have any thoughts on this?
I am stumped on this. I have set up a loop to send an email to multiple recipients on the same email, to allow reply all, and it is only sending to the first two listed. Thinking there was something wrong with my loop I even manually entered the email address in the code and still no luck... The funny thing is, when I look in the sent box, it appears it sends to everyone, but only the first two receive. Anyone have any thoughts on this?
Code:
Private Sub imgEMail_Click()
Dim Maildb As Object
Dim MailDoc As Object
Dim Body As Object
Dim Session As Object
Dim dblocation As String 'Definess the location
Dim rs As DAO.Recordset
Dim mydb As DAO.Database
On Error GoTo ErrorHandler
If MsgBox("Are you sure you want to send email to all recipients?", vbYesNo, "Send Email Review?") = vbNo Then
Exit Sub
Else
Set Session = CreateObject("Notes.NotesSession")
'get the name of the mailfile of the current user
dblocation = Session.GetEnvironmentString("MailFile", True)
'Get the notesdatabase for the mail.
Set Maildb = Session.GetDatabase("", dblocation)
If Maildb.IsOpen = True Then
WasOpen = 1 'Already open for mail
Else
Maildb.OPENMAIL 'This will open Lotus Notes if not running
End If
'Create the mail document
Set MailDoc = Maildb.CreateDocument
Call MailDoc.ReplaceItemValue("Form", "Memo")
'Set the recipient
Call MailDoc.ReplaceItemValue("SendTo", "" & "email1@mail.com, email2@mail.com, email3@mail.com, email4@mail.com,")
Call MailDoc.ReplaceItemValue("CopyTo", "" & "")
Call MailDoc.ReplaceItemValue("BlindCopyTo", "" & "")
'Set subject
Call MailDoc.ReplaceItemValue("Subject", "Subject here"
'Create and set the Body content
Set Body = MailDoc.CreateRichTextItem("Body")
Call Body.AppendText("Body goes here")
'Example to save the message (optional)
MailDoc.SaveMessageOnSend = True
'Send the document
'Gets the mail to appear in the Sent items folder
Call MailDoc.ReplaceItemValue("PostedDate", Now())
Call MailDoc.Send(False)
'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set Body = Nothing
Set Session = Nothing
Set mydb = Nothing
'Confirm Sent
MsgBox "Email Successfully Sent"
End If
Exit Sub
ErrorHandler:
MsgBox Err.Number & ": " & Err.Description & " (" & Erl & ")"
Exit Sub