473,326 Members | 2,012 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Question on SendMail object

RLN
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: <De******@company.comand not from "My****@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 ***
Jun 27 '08 #1
6 1470
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" <no****@devdex.comschreef in bericht
news:12************@news.newsfeeds.com...
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: <De******@company.comand not from "My****@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 ***

Jun 27 '08 #2
RLN

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 ***
Jun 27 '08 #3
RLN <no*******@devdex.comwrote in news:12************@news.newsfeeds.com:
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.
Jun 27 '08 #4
"RLN" <no*******@devdex.comschreef in bericht
news:12************@news.newsfeeds.com...
>
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.
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.
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
Jun 27 '08 #5
"Lars Brownie" <la**@brownie.comwrote:
>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/
Jun 27 '08 #6
Thanks for the tip. Didn't know about that.

"Tony Toews [MVP]" <tt****@telusplanet.netschreef in bericht
news:q2********************************@4ax.com...
"Lars Brownie" <la**@brownie.comwrote:
>>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/

Jun 27 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Babaloo | last post by:
Hello, I am having a problem with PHP 4.2.2 and RH 8. PHP is working fine except email. I have a test script to send mail, I have sendmail_path = '/usr/lib/sendmail -t -i' set in php.ini,...
3
by: Andrew Benjamin | last post by:
Hi I have a standalone machine running Mandrake 10 with apache server and PHP installed. The PHP mail() function is working but very slowly. It takes about 10-20 seconds to send a single...
2
by: theouimets | last post by:
I am trying to get mail() on a server and am having no luck. Other mail functions work fine. I have the following in php.ini: sendmail_path = "/usr/sbin/sendmail -t -i" In php there are no...
2
by: Garry Hodgson | last post by:
how do i use smtplib to send mail to someone with "cc" to someone else? if i just include the "to" addressees in the call to smtplib.sendmail(), and put the others in the "Cc" header fields, only...
4
by: jim | last post by:
Hello, I am having a problem w/SendMail reporting: " No recipient addresses found in header". Funny thing is though, I properly recieve the email message. Thanks for your help. -jim
2
by: daniel kaplan | last post by:
i want to turn this line open MAIL, "| /usr/sbin/sendmail -t" || die "Could not open sendmail: $!"; into something that goes like some variable = open MAIL, "| /usr/sbin/sendmail -t"; if...
7
by: nephish | last post by:
Hey there, i am using the smtplib module in python 2.3 my question is, this works: server = smtplib.SMTP(localhost) then server.sendmail(to address, from address, message)
3
by: swangdb | last post by:
I have a Sun Server running Solaris 10 and Sendmail 8.13.7. I have Majordomo and Listproc installed on this server and they work. I have several production majordomo and listproc mailing lists...
6
by: Guern1 | last post by:
Help Please I am very new to the Perl game and need some help I have a Perl application which works fine and can output some plain text information that I need to send to selected users via...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.