Multiple email addresses

BillyMac

Registered User.
Local time
Today, 10:10
Joined
Feb 27, 2004
Messages
24
Can anyone help. I have used code from this forum shown below:

Code:
On Error GoTo Err_Command68_Click

    Dim cn As ADODB.Connection
    Dim rs As ADODB.Recordset
    Dim strEmail As String

    Set cn = CurrentProject.Connection
    Set rs = New ADODB.Recordset

    rs.Open "EmailListTable", cn

    With rs
        Do While Not .EOF
        strEmail = strEmail & .Fields("EmailAddress") & ";"
        
                .MoveNext
        Loop
        .Close
End With

strEmail = Left(strEmail, Len(strEmail) - 1)

DoCmd.SendObject , , , strEmail, , , "Intranet", , True, ""
 
Exit_Command68_Click:
    Exit Sub

Err_Command68_Click:
    MsgBox Err.Description
    Resume Exit_Command68_Click
    
End Sub

The problem is I am getting this error:
"Unknown message recipient(s); the message was not sent"

Anyone got any ideas?
 
Last edited by a moderator:
Your code works for me

It's good code. And it worked for me. The only thing I can think of is that the problem might be that one of the eMail addresses in your list isn't correct and this is what's stopping things. Good luck with this.
 
Thanks for that Adam. I checked my email addresses and found nothing wrong with them except that the code I used to create them was including the ; (semi colon) in the address. When I removed this all worked well.
 

Users who are viewing this thread

Back
Top Bottom