Solved

Sendobject Fail

Posted on 2009-03-31
11
688 Views
Last Modified: 2012-05-06
I have set up a function for my client to emal information directly out of their MS Access application.  I am using the SendObject command as shown in the code window.

To initiate this process the user must first enter an email address on the form in my application, then click the 'email' button that I put there.  The emails are only sent successfully if the entered email address exists in the users MS Outlook address book.

If the email address is not in the users MS Outlook address book an error comes up and the email is not sent.  Unfortunately I didn't write the error down but the message is something about could not validate email address in address book.

Alot of these emails are one time shots and the user doesn't want to clutter his address book with them or take the time and extra steps to put them in the address book.

How can I get around this issue?
DoCmd.SendObject acSendReport, _
                 "rptEmailsSent", _
                 acFormatRTF, _
                 eMailTo, _
                 eMailCC, _
                 eMailBCC, _
                 eMailSubject, _
                 eMailBody, _
                 False

Open in new window

0
Comment
Question by:mlcktmguy
  • 6
  • 5
11 Comments
 
LVL 28

Expert Comment

by:TextReport
ID: 24033274
If the email addresses are in the form of UserName@DomainName.Com or the like they should work, if the are John Smith then it would have to be resolved to the Address book.
Cheers, Andrew
0
 
LVL 1

Author Comment

by:mlcktmguy
ID: 24033739
The user is entering a valid emal address in the form of UserName@DomainName.Com.
0
 
LVL 28

Expert Comment

by:TextReport
ID: 24033787
Are the variables eMailTo, eMailCC and eMailBCC all defined as strings?
What version of Outlook are you using?
Cheers, Andrew
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 1

Author Comment

by:mlcktmguy
ID: 24034544
Yes, all defined as strings.  They are using Outlook 2007.

The emails are sent as long as the address the user types in is also in the address book.

0
 
LVL 28

Expert Comment

by:TextReport
ID: 24036831
"The emails are sent as long as the address the user types in is also in the address book." I can not see anything that would force the either in Access or Outlook. I am using Access 2007 and Outlook 2007 and sending emails all the time without a problem to unlisted addresses but I do not use SendObject I use MAPI code.

Can the user create an email and send it to an address not in the addressbook manually?
Are you using an Exchange Server?
I suspect it is to do with the security features to stop viruses.

Cheers, Andrew
0
 
LVL 28

Expert Comment

by:TextReport
ID: 24036852
I have just tried to use the SendObject in Access 2007 through Outlook 2007 and it advises me that a program is trying to send an email, do I want to allow it. This happens if the email address is in the address book or not.
Cheers, Andrew
0
 
LVL 1

Author Comment

by:mlcktmguy
ID: 24038204
Yes they also get the message asking to allow the email and they respond correctly.

From that point on is where the difference is, and the error is thrown based on whether the entered address is in the address book or not.
0
 
LVL 28

Assisted Solution

by:TextReport
TextReport earned 250 total points
ID: 24038394
I hardly ever use the SendObject command and I normally send emails through code that I have had / updated through many versions of Access. If you are interested then I can paste a copy of the code for you.
Cheers, Andrew
0
 
LVL 1

Author Comment

by:mlcktmguy
ID: 24098373
Finally got the specific error message that the client is getting: 2295
0
 
LVL 28

Expert Comment

by:TextReport
ID: 24099830
Can you advise the error message as well as the error number.
Cheers, Andrew
0
 
LVL 1

Accepted Solution

by:
mlcktmguy earned 0 total points
ID: 24204384
They didn't supply the message however, I searched the error number on EE and came up with "Error 2295:  Unknown message recipients".

For the time being I have put a trap in the code for that specific error number.  If it occurs I show the user a message and continue on without sending the email.

Prior to this my generic error trapping was cancelling execution and kicking them out of the system.

It didn't resolve the specifc issue but handles it much more gracefully when the error does occur.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question