Page [ 1 ]      
 Basic Outlook
Working with Outlook items, folders, recipients; dealing with security; writing event handlers
Topic
Run Time Error 287
Hello, i'm getting Run Time Error 287 in some computers at work when sending an email via vb using .send property but in some computers it working perfectly fine. what would you think the problem and how to resolve it? we are all using OL 2003.

  14-Jul-2009  16:12
  14-Jul-2009  16:14   
Do you mean that you're getting 287 when you invoke the MailItem.Send method (not property)? Are you calling ResolveAll and resolving all recipients resolved before you attempt to send? If not, that's a change you need to make.
  14-Jul-2009  16:26   
thanks sue. I'll try again but would you know why it is working with other machines at work and not on some?
  14-Jul-2009  16:31   
If the problem is with unresolved recipients, they could have differences in their address books.
  14-Jul-2009  16:40   
the thing is the recipients are actually external users are not existing in our addressbook. also, i have a macro that checks if the value in the TO field is a correct format of an email address. so i tried in one machine and set the recipient as abc@gmail.com and it worked perfectly and tried on another machine with the same recipient, and there! i got the error 287. :(
  14-Jul-2009  16:49   
>> i have a macro that checks if the value in the TO field is a correct format of an email address.

I'm not sure why you'd want to do that, given that the built-in Recipient.Resolve and Recipients.ResolveAll methods will take care of that for you.

If you want to explore this further, you should provide information on the type of application (add-in vs. standalone, VSTO vs. shared add-in) and enough code to show how the item is being created and sent.
  14-Jul-2009  17:02   
thanks sue for helping out. here's my code:

Set myemail = Application.CreateItem(olMailItem)
myemail.SentOnBehalfOfName = "team 1"
myemail.To = "abc@yahoo.com"
myemail.Subject = "Receipt Confirmation"
myemail.Body = textbox1.text
myemail.Send

i am not using any any add-ins for this.
  14-Jul-2009  17:15   
So this is a standalone application? Or did you write VB earlier when you meant VBA?

I still would call myemail.Recipients.ResolveAll before sending. Also, there's the possibility that "team 1" might not be resolving. What happens if you type that into the To box on a problem machine and try to resolve it manually?
    Page [ 1 ]