Solved

Change the reply email address of emails generated from MS-Access Database

Posted on 2006-11-26
7
321 Views
Last Modified: 2012-06-21
G'day Folks,

I'm just wondering if anyone knows how to change the reply email address of emails generated from MS-Access using either default mail client (Outlook or OE). Basically I have a a quote management system sitting on a Windows 2000 Server - about 10 users access the DB using Terminal Services, so if I want them to each send emails I have to somehow custom generate the email and tag it with the users specific reply email address, so they can receive any follow up emails from the quote.
I've had a look, but I can't seem to see much in the properties of the 'MailItem' Outlook (VBA object)... just the ReplyRecipients and SendEmailAddress, but both seem to be read only properties.
If anyone's done this before or knows a way to, please lend us a hand.

Cheers, Chyro
0
Comment
Question by:CHYRO
  • 4
  • 3
7 Comments
 
LVL 34

Expert Comment

by:jefftwilley
ID: 18016267
If the e-mail is sent by a specific rep, the e-mail is delivered to the recipient with that rep's e-mail address correct? Wouldn't that then be the reply to address? Are you able to do this already? I'm not aware of a specific reply to address in the automation feature. Is the following what you're using?

        Set olkApp = New Outlook.Application
        Set olkNameSpace = olkApp.GetNamespace("MAPI")
        Set objMailItem = olkApp.CreateItem(olMailItem)
            With objMailItem
                .To = strTo
                .CC = "Enter E-Mail Address Here"
                .BCC = "Enter E-Mail Address Here"
                .Subject = EmailSubject
                .Body = Emailbody
                .Attachments.Add Attachment1
                    If FileExist(Attachment2) Then
                        .Attachments.Add Attachment2
                    End If
                .Display 'change this to "send" if you don't want to preview the e-mail
            End With
0
 

Author Comment

by:CHYRO
ID: 18017626
Hi jefftwilley,

Yes the code I use is similar to what you have posted. but because each user is using the same credentials/windows profile to login into terminal services, they are using the same configuration in the email client, i.e only one 'sent from'/'reply email address'. So I therefore need to change the 'reply email address' of the generated email on the fly to a value associated with the specific rep that is logged into the db (The db has its own log on that can be used to identify which rep is logged on)... I hope this explains it a bit better.
Bascially I need to somehow have multiple sales reps sending emails that look to come from them individually when they are all using the same windows account through TS.

Cheers, Chyro

p.s. Perhaps it's possible to set up multiple identies in Outlook Express, and then use a specific identity to send emails dependant on who is logged in ?
0
 
LVL 34

Expert Comment

by:jefftwilley
ID: 18019253
It's possible...sure. Not sure how the outlook model handles that as of yet....but. Here's a CDO method that may serve your purpose.

http://www.experts-exchange.com/Databases/MS_Access/Q_21136836.html?query=change+the+sender+on+email+from+access&topics=39


Another option is to use a handler (API) that launches the default e-mail directly and allows you to pass in a "From" arguement
http://www.experts-exchange.com/Databases/MS_Access/Q_21417170.html

I'm still researching the outlook method. I'd kind of like to know myself. Hang in there.
J
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 34

Expert Comment

by:jefftwilley
ID: 18019293
an alternative also

You can use the constants olTo, olCC, and olBCC to set the To, Cc, and Bbc address fields of the MailItem. However, olOriginator does not set the From field.

To set the From field, use the SentOnBehalfOfName property of the Item object. The following example demonstrates the use of the SentOnBehalfOfName property: Sub TestSentOnBehalfOfName()

   Dim myOlApp as Outlook.Application
   Dim myItem as Outlook.MailItem

   ' Create an Outlook application object
   Set myOlApp = New Outlook.Application

   ' Creates a new MailItem form
   Set myItem = myOlApp.CreateItem(olMailItem)

   ' Set the "From" field
   myItem.SentOnBehalfOfName = "Jon Grande"

   ' Display the item
   myItem.Display

End Sub

0
 
LVL 34

Accepted Solution

by:
jefftwilley earned 125 total points
ID: 18019297
That last method will require that you set permissions on each user's account to allow the term e-mail source to send on behalf of. Otherwise, should work.
J
0
 

Author Comment

by:CHYRO
ID: 18035058
Thanks jefftwilley,

Give me a couple of days, and the customer is remot from here, and I will test you method, and then get back to you...

Cheers, Chyro
0
 

Author Comment

by:CHYRO
ID: 18346236
Sorry that took a few more than a couple of days and I haven't actually even seen whether it will work, but I will give you the benefit fo the doubt and award the points - Thanks very much for you time and effort Jeff - give my regards to Brian if you know him
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

828 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