Results 1 to 4 of 4
  1. #1
    Juan23 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Sep 2011
    Location
    SE Washington
    Posts
    6

    Outlook error message using SendObject method

    Merry Christmas to all, hope you have a nice holiday!

    I use the SendObject method to perform a periodic email to several email recipients. The email addresses are compiled through a loop statement, the message is created and an attachment is emailed.

    The odd thing is, for one particular batch of recipients, I get the following error message from MS Outlook. But with all other batches of recipients, the email works great. I'm not sure if this is a Access problem or an Outlook problem.

    So here is a code snippet;

    Dim strReport As String
    Dim strEmail As String
    Dim strSubject As String
    Dim strMessage As String

    strReport = "RptScheduleMain_Project" 'name of report
    strEmail = ProjectEmail(Me.ProjectID) 'function to compile a string of email addresses
    strSubject = "Schedule"


    strMessage = "Hello World "



    DoCmd.SendObject acSendReport, strReport, acFormatPDF, strEmail, , , strSubject, strMessage, False


    The snotty gram I get from Outlook is:
    "Unknown message recipient; the message was not sent"

    I can send email to these same folks without any problems. I can leave the strEmail string blank and input the email addresses manually without any problems.

    Any thoughts/suggestions?

  2. #2
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Sounds like you need to debug what is being returned to strEmail and find what is causing the Unknown message recipient message.

    Put a

    Debug.Print strEmail

    just after the line that sets it and then go to the Immediate Window after it fails and see what the string says.

  3. #3
    Juan23 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Sep 2011
    Location
    SE Washington
    Posts
    6
    Bob. Your suggestion got me thinking. I carefully reviewed through all the email addresses in my table and found a "simple" syntax error in some of them. Obviously a fat-finger error.

    Sometimes when you look at the same thing a million times you don't notice the little details.

    Thanks ...........

  4. #4
    Glenn_Suggs is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Oct 2012
    Posts
    72
    I ran into the same error message with the SendObject method. However, I'm getting the email address from the "username" environment variable. Our company generally uses the logon ID as the first part of everyone's email address, but there are some users that get the error mentioned in this post. "Unknown message recipient; the message was not sent" Not only that, if two sendobjects are used one after the other, sometimes it sends to one person and when the second one tries to send a copy back to the sending user, it doesn't recognize the recipient that's logged on and actually trying to send the email. That's the one that comes from the environment variable. But I've tried hard-coding the recipient and bypassing the variable altogether and it still generates the same error. Can anyone please help with this problem? Thanks in advance.
    Glenn

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 11-18-2011, 03:46 PM
  2. Import Outlook email message
    By crowegreg in forum Import/Export Data
    Replies: 5
    Last Post: 09-27-2011, 11:10 PM
  3. Aligning email message text when using SendObject
    By msoares in forum Programming
    Replies: 1
    Last Post: 02-15-2011, 07:22 AM
  4. SendObject Message
    By williammarino in forum Forms
    Replies: 4
    Last Post: 10-06-2009, 01:54 AM
  5. Replies: 1
    Last Post: 03-09-2006, 01:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums