• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 456
  • Last Modified:

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.

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
With objEmail
    '.To = i want this to be the person who is composing the email
    .subject = subject
    .Body = letterBody
    '.ReadReceiptRequested = True
    .BCC = strTo
End With

Open in new window

1 Solution
Kelvin SparksCommented:
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
Neil2526Author 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.

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.
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


Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now