Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old June 27th, 2008, 08:22 PM
RLN
Guest
 
Posts: n/a
Default Question on SendMail object

Re: Access 2003

I have a line of code in my app that sends an email after these strings
are populated: gblSendTo, gblEMailSubject, and gblEMailBody.

DoCmd.SendObject , "", "", gblSendTo, "", "", gblEMailSubject,
gblEMailBody, False, ""

Currently, when the email is sent internally in our company, the "From:"
in the email is my own personal work address.

I did not see in the syntax (unless I missed it) where the "From:" can
be set in the "SendMail" object in Access.

There is a department address we can use as the "From".

How do I change my code so that when the users see the email sent by the
app, it shows up as
"From: <DeptName@company.comand not from "MyName@company.com"?

Thanks.

(I don't know if this matters or not, but we useMicrosoft Exchange
Server for internal email.)



*** Sent via Developersdex http://www.developersdex.com ***
  #2  
Old June 27th, 2008, 08:22 PM
Lars Brownie
Guest
 
Posts: n/a
Default Re: Question on SendMail object

I don't think this can be done with SendObject. However, you cán do it with
Outlook automation, more specifically using the .SendOnBehalfOf property,
see:

http://www.talkaboutdatabases.com/gr...es/887159.html

Lars

"RLN" <nospam@devdex.comschreef in bericht
news:1208813425_120@news.newsfeeds.com...
Quote:
Re: Access 2003
>
I have a line of code in my app that sends an email after these strings
are populated: gblSendTo, gblEMailSubject, and gblEMailBody.
>
DoCmd.SendObject , "", "", gblSendTo, "", "", gblEMailSubject,
gblEMailBody, False, ""
>
Currently, when the email is sent internally in our company, the "From:"
in the email is my own personal work address.
>
I did not see in the syntax (unless I missed it) where the "From:" can
be set in the "SendMail" object in Access.
>
There is a department address we can use as the "From".
>
How do I change my code so that when the users see the email sent by the
app, it shows up as
"From: <DeptName@company.comand not from "MyName@company.com"?
>
Thanks.
>
(I don't know if this matters or not, but we useMicrosoft Exchange
Server for internal email.)
>
>
>
*** Sent via Developersdex http://www.developersdex.com ***

  #3  
Old June 27th, 2008, 08:23 PM
RLN
Guest
 
Posts: n/a
Default Re: Question on SendMail object


Thank you for this tip here. I am going to try the code from the link
you provided.

I am somewhat new to using the Outlook Object model inside of an Access
app. If you have any tips or good coding practices for using this this
specific object model efficiently, I would welcome your suggestions.

I read in another thread where "SendOnBehalfOf" has a permission that
has to be granted. Where is this set/modified?

In my Access app, the "From" address must change before the email is
sent, only if the current record in the database came from a source
different than the previous record.


*** Sent via Developersdex http://www.developersdex.com ***
  #4  
Old June 27th, 2008, 08:23 PM
lyle fairfield
Guest
 
Posts: n/a
Default Re: Question on SendMail object

RLN <nospamrln@devdex.comwrote in news:1209053070_367@news.newsfeeds.com:
Quote:
I am somewhat new to using the Outlook Object model inside of an Access
app. If you have any tips or good coding practices for using this this
specific object model efficiently, I would welcome your suggestions.
I suggest that you use CDO.
  #5  
Old June 27th, 2008, 08:23 PM
Lars Brownie
Guest
 
Posts: n/a
Default Re: Question on SendMail object

"RLN" <nospamrln@devdex.comschreef in bericht
news:1209053070_367@news.newsfeeds.com...
Quote:
>
Thank you for this tip here. I am going to try the code from the link
you provided.
>
I am somewhat new to using the Outlook Object model inside of an Access
app. If you have any tips or good coding practices for using this this
specific object model efficiently, I would welcome your suggestions.
To use it you must make sure that the Outlook reference in Access is
checked.
Quote:
I read in another thread where "SendOnBehalfOf" has a permission that
has to be granted. Where is this set/modified?
In the exchange server the users should have send-as rights on the
department mailbox.
Quote:
In my Access app, the "From" address must change before the email is
sent, only if the current record in the database came from a source
different than the previous record.
In your code you can set the SendOnBehalfOf property or not set it at all on
the basis of the criteria you mention.

Lars


  #6  
Old June 27th, 2008, 08:23 PM
Tony Toews [MVP]
Guest
 
Posts: n/a
Default Re: Question on SendMail object

"Lars Brownie" <lars@brownie.comwrote:
Quote:
>To use it you must make sure that the Outlook reference in Access is
>checked.
However, given that folks may have different versions of Outlook installed or maybe
not even have it installed, I'd suggest switching your code to late binding once it's
working.

Late binding means you can safely remove the reference and only have an error when
the app executes lines of code in question. Rather than erroring out while starting
up the app and not allowing the users in the app at all. Or when hitting a mid, left
or trim function call.

For more information including additional text and some detailed links see the "Late
Binding in Microsoft Access" page at http://www.granite.ab.ca/access/latebinding.htm

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
  #7  
Old June 27th, 2008, 08:23 PM
Lars Brownie
Guest
 
Posts: n/a
Default Re: Question on SendMail object

Thanks for the tip. Didn't know about that.

"Tony Toews [MVP]" <ttoews@telusplanet.netschreef in bericht
news:q2m11455fcdqeqqloi7lnqiturhc633924@4ax.com...
Quote:
"Lars Brownie" <lars@brownie.comwrote:
>
Quote:
>>To use it you must make sure that the Outlook reference in Access is
>>checked.
>
However, given that folks may have different versions of Outlook installed
or maybe
not even have it installed, I'd suggest switching your code to late
binding once it's
working.
>
Late binding means you can safely remove the reference and only have an
error when
the app executes lines of code in question. Rather than erroring out
while starting
up the app and not allowing the users in the app at all. Or when hitting
a mid, left
or trim function call.
>
For more information including additional text and some detailed links see
the "Late
Binding in Microsoft Access" page at
http://www.granite.ab.ca/access/latebinding.htm
>
Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/

 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles