We help IT Professionals succeed at work.

Outlook.Application. Trying to specify 'To' recipient by using the 'From' field.

Sorry for the confusing title.

I am automating emails. I build a string of email addresses that I am sending templates to (not spam =P ). I am sending them via BCC. So I want to make myself the person I am sending the email to.  Is there an attribute in Outlook.Application that uses that?

code snipit below.

Thanks!
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
 
'query database to get rs3 result set
 
'correctly builds my recipient string
Do Until rs3.EOF
 strTo = rs3.Fields(7).Value & "; " & strTo
 rs3.MoveNext
Loop
 
With objEmail
    '.To = i want this to be the person who is composing the email
    .subject = subject
    .Body = letterBody
    '.ReadReceiptRequested = True
    .BCC = strTo
    .Send
End With

Open in new window

Comment
Watch Question

CERTIFIED EXPERT

Commented:
You can either hard code your email address in the .To line or make it equal to a input box where the user enters their email address

Author

Commented:
Thank you for your comment kelvin.

I'd like to stray from hard coding the email address in the code because different people may be sending out emails. I also don't have any input as to who enters their email address.  I was hoping there would be another way.

-Ed

Commented:
How do you want the system to know who the sender is? I have used some code that gets the user login name. That could possibly be used to  lookup the email address of the sender but I would need to know more.
Top Expert 2006
Commented:
About the best you'll get is using the Resolve action to attempt to make use of a user's login as gemost has mentioned. Here's a full reference if you want to look into the resolve option
http://msdn2.microsoft.com/en-us/library/aa159619(office.11).aspx#odc_ac_olauto_sendanoutlookmessageusingaccess

J

Explore More ContentExplore courses, solutions, and other research materials related to this topic.