Link to home
Start Free TrialLog in
Avatar of Neil2526
Neil2526

asked on

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

Avatar of Kelvin Sparks
Kelvin Sparks
Flag of New Zealand image

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
Avatar of Neil2526
Neil2526

ASKER

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
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.
ASKER CERTIFIED SOLUTION
Avatar of jefftwilley
jefftwilley
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial