By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,647 Members | 1,588 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,647 IT Pros & Developers. It's quick & easy.

simple email from access

P: n/a
I have searched through the posts for a question like mine but have
only found much more complicated responses.

On single record view of a form I have an email address field. I
merely want to create a button that will email the same message (and
idealy a word attachment) to whatever address is in view on the form
(chances are that I just input it).

For further explanation:

I am systematically going throug a list of prospects and view them one
at at time on the form. When I contact someone who agrees to allow me
to send them a mail, I want to just push the button and away it goes
(a couple dialog boxes in the mean time are OK).

The mail would have a fixed subject like "I'll call you later". The
message would have a brief explanation of my services suggesting they
open the word attachment for a prettier and more detailed explanation.
If the word attachment complicates things too much I can use another
format such as an access report.

I have some of the components in place now and it seems to be working
but the tests I have done are still in the outbox of outlook. I use
outlook express exclusively for my mail now. Will I have to change
that somewhere and if so where and how.

Thanks,

Bill
Nov 13 '05 #1
Share this Question
Share on Google+
19 Replies


P: n/a
Pat
Bill,
Tony Toews has a great FAQ on email that should give you some options. My
personal favorite is CDONTS, since it's so simple.
http://www.granite.ab.ca/access/email.htm
Pat

"Bill" <bb***@iquest.net> wrote in message
news:7f**************************@posting.google.c om...
I have searched through the posts for a question like mine but have
only found much more complicated responses.

On single record view of a form I have an email address field. I
merely want to create a button that will email the same message (and
idealy a word attachment) to whatever address is in view on the form
(chances are that I just input it).

For further explanation:

I am systematically going throug a list of prospects and view them one
at at time on the form. When I contact someone who agrees to allow me
to send them a mail, I want to just push the button and away it goes
(a couple dialog boxes in the mean time are OK).

The mail would have a fixed subject like "I'll call you later". The
message would have a brief explanation of my services suggesting they
open the word attachment for a prettier and more detailed explanation.
If the word attachment complicates things too much I can use another
format such as an access report.

I have some of the components in place now and it seems to be working
but the tests I have done are still in the outbox of outlook. I use
outlook express exclusively for my mail now. Will I have to change
that somewhere and if so where and how.

Thanks,

Bill

Nov 13 '05 #2

P: n/a
Lyle Fairfield just posted code that sends mail through Outlook
Express. Check the last few days of postings.
Nov 13 '05 #3

P: n/a
Use SendObject to pickup the email address from the form, and you can
specify the subject line and body text, but probalby not the attachment.

If you need something more, see Tony Toews' Access Email FAQ at:
http://www.granite.ab.ca/access/email.htm

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Bill" <bb***@iquest.net> wrote in message
news:7f**************************@posting.google.c om...
I have searched through the posts for a question like mine but have
only found much more complicated responses.

On single record view of a form I have an email address field. I
merely want to create a button that will email the same message (and
idealy a word attachment) to whatever address is in view on the form
(chances are that I just input it).

For further explanation:

I am systematically going throug a list of prospects and view them one
at at time on the form. When I contact someone who agrees to allow me
to send them a mail, I want to just push the button and away it goes
(a couple dialog boxes in the mean time are OK).

The mail would have a fixed subject like "I'll call you later". The
message would have a brief explanation of my services suggesting they
open the word attachment for a prettier and more detailed explanation.
If the word attachment complicates things too much I can use another
format such as an access report.

I have some of the components in place now and it seems to be working
but the tests I have done are still in the outbox of outlook. I use
outlook express exclusively for my mail now. Will I have to change
that somewhere and if so where and how.

Thanks,

Bill

Nov 13 '05 #4

P: n/a
Please note that there are several problems with Lyle's code for apps that
need to support more than English, including the hard-coded path to Outlook
Express that assumes the English directory name for "Program Files" and the
improper use of Unicode conversion (converting the Unicode VBA strings to
"double Unicode") which causes the code to fail on CJK platforms.

There is a link to it from somewhere off of Tony's site at
http://www.granite.ab.ca/access/email.htm I believe.
--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies
Windows International Division

This posting is provided "AS IS" with
no warranties, and confers no rights.
"Pieter Linden" <pi********@hotmail.com> wrote in message
news:bf************************@posting.google.com ...
Lyle Fairfield just posted code that sends mail through Outlook
Express. Check the last few days of postings.

Nov 13 '05 #5

P: n/a
Please try to overcome your disgust and accept my appologies for my
ignorance.

I copied and pasted the cdonts code (of course I removed the bullets
beginning each line) into the event on my form and it is balking. Is
this where it was supposed to go. I checked access help and it doesn't
seem to recognize cdonts.

Where was this code supposed to go?
Bill
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #6

P: n/a
"Pat" <no*****@ihatespam.bum> wrote in
news:_V*****************@fe1.texas.rr.com:
Tony Toews has a great FAQ on email that should give you some
options. My personal favorite is CDONTS, since it's so simple.
http://www.granite.ab.ca/access/email.htm


Keep in mind, though, that if the machine you're sending it from
does not have a fixed IP address, any recipient whose ISP is using
one of the real-time black holes that includes all dynamic IP host
addresses will likely classify your messages as spam, and may even
simply reject the email entirely.

You many never know if your email message failed to get to the
recipient.

Perhaps it's possible to control CDONTS in a fashion that you can
specify your ISP's SMTP server as the only relay it uses, and
perhaps you can have CDONTS authenticate on that SMTP server. If
that's the case, that would be a safe and reliable method for
sending email.

However, I don't seen any SMTP service on my Win2K workstation, and
Tony's code fails to work (even after I fix the errors in it, where
it lacks "=" for setting properties).

It doesn't seem as though there's any way to control the SMTP server
it connects to, I see now that I have tested it, so it probably
isn't really usable after all.

Most of my clients are happy with SENDOBJECT, because their SENT
MESSAGES folder in their email client then has a copy of the mail
they send out. SENDOBJECT also uses your default email client's SMTP
settings, so it's not going to generate messages that are likely to
get rejected as spam.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #7

P: n/a
Pat
William,
You will need to be on an NT-based machine (NT/2K,XP) and have the reference
for CDO Library checked. (see Allen Brown's site for more info on
references - http://members.iinet.net.au/~allenbrowne/ser-38.html).

You can place the code in the form module or in a separate module with the
control event referencing the function.
Hope this gets you started.
Pat
"William Hepburn" <bb***@iquest.net> wrote in message
news:40**********************@news.newsgroups.ws.. .
Please try to overcome your disgust and accept my appologies for my
ignorance.

I copied and pasted the cdonts code (of course I removed the bullets
beginning each line) into the event on my form and it is balking. Is
this where it was supposed to go. I checked access help and it doesn't
seem to recognize cdonts.

Where was this code supposed to go?
Bill
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 13 '05 #8

P: n/a
Pat
David,
You are absolutely right about the blackholes listings - this could indeed
be a problem with the CDONTS function on Tony's site. I've actually had
great success however with another function using the CDO library:

Sub SendEmail()
Const MailSender as String = "sender @ yourdomain.com"
Const MailRecipient as String = "recipient @ anotherdomain.com"
Const MailCCRecipient as String = "cc @ anotherdomain.com"
Const MailSubject as String = "Here's an email with an attachment"
Const MailBody as Strnig = "See the attachment"

Dim iMsg as New CDO.Message
Dim iConf as New CDO.Configuration
Dim Flds as New CDO.Fields
Dim strAttachment as String

strAttachment = "C:\somefile.txt"

With Flds
.Item(cdoSMTPServer) = "ip address or name of smtp server"
.Item(cdoSMTPServerPort) = 25 ' typically
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPConnectionTimeout) = 200
.Item(cdoSMTPAuthenticate) = cdoNTLM
End With

With iMsg
Set .Configuration = iConf
.To = MailRecipient
.CC = MailCCRecipient
.From = MailSender
.Subject = MailSubject
.TextBody = MailBody
.AddAttachment (strAttachment)
.MDNRequested = True 'return receipt on
.Send
End With

End Sub

This routine does allow you to specify the IP address (or UNC) for a valid
SMTP server - just make sure it's accepting mail relay from your IP! You'll
notice a method for CDO.Fields that allows for authentication. This
function has an extra flair in that you can set a flag for return receipt,
but we all now how easily a recipient can block that. However, you will
have to have SMTP Service configured on the machine running the routine -
just add the service and have your windows setup CD handy - you'll basically
be installing the IIS component.

Hope this works for you. I've found it to be a nice work around to avoid
patching Outlook so as not to get the security warnings. Curious to hear if
you have other problems or reservations about this routine.
Pat

"David W. Fenton" <dX********@bway.net.invalid> wrote in message
news:Xn**********************************@24.168.1 28.86...
"Pat" <no*****@ihatespam.bum> wrote in
news:_V*****************@fe1.texas.rr.com:
Tony Toews has a great FAQ on email that should give you some
options. My personal favorite is CDONTS, since it's so simple.
http://www.granite.ab.ca/access/email.htm


Keep in mind, though, that if the machine you're sending it from
does not have a fixed IP address, any recipient whose ISP is using
one of the real-time black holes that includes all dynamic IP host
addresses will likely classify your messages as spam, and may even
simply reject the email entirely.

You many never know if your email message failed to get to the
recipient.

Perhaps it's possible to control CDONTS in a fashion that you can
specify your ISP's SMTP server as the only relay it uses, and
perhaps you can have CDONTS authenticate on that SMTP server. If
that's the case, that would be a safe and reliable method for
sending email.

However, I don't seen any SMTP service on my Win2K workstation, and
Tony's code fails to work (even after I fix the errors in it, where
it lacks "=" for setting properties).

It doesn't seem as though there's any way to control the SMTP server
it connects to, I see now that I have tested it, so it probably
isn't really usable after all.

Most of my clients are happy with SENDOBJECT, because their SENT
MESSAGES folder in their email client then has a copy of the mail
they send out. SENDOBJECT also uses your default email client's SMTP
settings, so it's not going to generate messages that are likely to
get rejected as spam.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc

Nov 13 '05 #9

P: n/a
"Pat" <no*****@ihatespam.bum> wrote in
news:i7******************@fe2.texas.rr.com:
This routine does allow you to specify the IP address (or UNC) for
a valid SMTP server - just make sure it's accepting mail relay
from your IP! You'll notice a method for CDO.Fields that allows
for authentication. This function has an extra flair in that you
can set a flag for return receipt, but we all now how easily a
recipient can block that. However, you will have to have SMTP
Service configured on the machine running the routine - just add
the service and have your windows setup CD handy - you'll
basically be installing the IIS component.


Well, it's good to know that it's doable, but having to install IIS
means it's basically unusable -- IIS is so full of security holes
that you really don't want it running on any machine, server or
workstation.

It's too bad MS makes these things so monolithic. There's no reason
that a local SMTP server should be dependent on an HTTP server.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #10

P: n/a
"David W. Fenton" <dX********@bway.net.invalid> wrote:
Well, it's good to know that it's doable, but having to install IIS
means it's basically unusable -- IIS is so full of security holes
that you really don't want it running on any machine, server or
workstation.


<shrug> My website has been been running Win 2000/2003 Server and IIS for a number
of years now. No one's gotten through yet.

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
Nov 13 '05 #11

P: n/a
rkc

"Tony Toews" <tt****@telusplanet.net> wrote in message
news:cc********************************@4ax.com...
"David W. Fenton" <dX********@bway.net.invalid> wrote:
Well, it's good to know that it's doable, but having to install IIS
means it's basically unusable -- IIS is so full of security holes
that you really don't want it running on any machine, server or
workstation.
<shrug> My website has been been running Win 2000/2003 Server and IIS for

a number of years now. No one's gotten through yet.


Meaningless information.
Why would anyone want to break into your website?

Nov 13 '05 #12

P: n/a
"rkc" <rk*@yabba.dabba.do.rochester.rr.bomb> wrote:
>Well, it's good to know that it's doable, but having to install IIS
>means it's basically unusable -- IIS is so full of security holes
>that you really don't want it running on any machine, server or
>workstation.


<shrug> My website has been been running Win 2000/2003 Server and IIS for

a number
of years now. No one's gotten through yet.


Meaningless information.
Why would anyone want to break into your website?


1) It's out there. Surely by now those worms and such would've hit every IP address
on this planet.

2) There are a few people who don't like me. CJ3 and DPM.

3) When I look in my logs at least once a week I see a script attack of some sort
trying the various holes.

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
Nov 13 '05 #13

P: n/a
On 8 Jul 2004 15:32:32 -0700, bb***@iquest.net (Bill) wrote:
I have searched through the posts for a question like mine but have
only found much more complicated responses.

On single record view of a form I have an email address field. I
merely want to create a button that will email the same message (and
idealy a word attachment) to whatever address is in view on the form
(chances are that I just input it).

For further explanation:

I am systematically going throug a list of prospects and view them one
at at time on the form. When I contact someone who agrees to allow me
to send them a mail, I want to just push the button and away it goes
(a couple dialog boxes in the mean time are OK).

The mail would have a fixed subject like "I'll call you later". The
message would have a brief explanation of my services suggesting they
open the word attachment for a prettier and more detailed explanation.
If the word attachment complicates things too much I can use another
format such as an access report.

I have some of the components in place now and it seems to be working
but the tests I have done are still in the outbox of outlook. I use
outlook express exclusively for my mail now. Will I have to change
that somewhere and if so where and how.

Thanks,

Bill


I notice that no one has yet mentioned BLAT. In spite of the fact that one
must first write the message to a file, then run an external executable, and
in spite of the fact that, to set up your application, you must, at some point
provide the name or IP address of the SMTP server to send through, I have
found BLAT to be, by far the least problematic way of sending e-mail from
Access or any other VB/VBA program. It doesn't matter which (if any) e-mail
client is installed, whether Exchange Server is on the network, etc.

Just put blat.exe somewhere, tell the application where it is, tell the
application the info it needs to connect to the SMTP server, and have the
application write a text file, and call blat.exe. Pass all known parameters
to blat, so it doesn't matter how its default configuration is set up.

http://www.blat.net/
Nov 13 '05 #14

P: n/a
On Fri, 9 Jul 2004 06:54:28 -0700, "Michael \(michka\) Kaplan [MS]"
<mi*****@online.microsoft.com> wrote:
Please note that there are several problems with Lyle's code for apps that
need to support more than English, including the hard-coded path to Outlook
Express that assumes the English directory name for "Program Files" and the
improper use of Unicode conversion (converting the Unicode VBA strings to
"double Unicode") which causes the code to fail on CJK platforms.

There is a link to it from somewhere off of Tony's site at
http://www.granite.ab.ca/access/email.htm I believe.


I think it's rather a given that most example code that wasn't written to
handle multiple languages will need some adaptation to work that way. It
would be nice if our tools and APIs made it harder to write code that doesn't
work multi-lingually instead of hard to write code that does work
multi-lingually.
Nov 13 '05 #15

P: n/a
rkc

"Tony Toews" <tt****@telusplanet.net> wrote in message
news:8f********************************@4ax.com...
"rkc" <rk*@yabba.dabba.do.rochester.rr.bomb> wrote:
>Well, it's good to know that it's doable, but having to install IIS
>means it's basically unusable -- IIS is so full of security holes
>that you really don't want it running on any machine, server or
>workstation.

<shrug> My website has been been running Win 2000/2003 Server and IIS
fora number
of years now. No one's gotten through yet.


Meaningless information.
Why would anyone want to break into your website?


3) When I look in my logs at least once a week I see a script attack of

some sort trying the various holes.

Now that is interesting. That brings several questions to mind, but I
guess Google is a better place to ask them.

Nov 13 '05 #16

P: n/a
"rkc" <rk*@yabba.dabba.do.rochester.rr.bomb> wrote:
3) When I look in my logs at least once a week I see a script attack of

some sort trying the various holes.

Now that is interesting. That brings several questions to mind, but I
guess Google is a better place to ask them.


Ask away although we are straying off topic. OTOH that server is running my
granite.ab.ca website so it's very slightly on topic. <smile>

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
Nov 13 '05 #17

P: n/a
Tony Toews <tt****@telusplanet.net> wrote in
news:cc********************************@4ax.com:
"David W. Fenton" <dX********@bway.net.invalid> wrote:
Well, it's good to know that it's doable, but having to install
IIS means it's basically unusable -- IIS is so full of security
holes that you really don't want it running on any machine, server
or workstation.


<shrug> My website has been been running Win 2000/2003 Server and
IIS for a number
of years now. No one's gotten through yet.


Having it running on a server is completely different (if highly
inadvisable, in my opinion) than having it running on every
workstation where your Access app is being used. On a server, you
have it appropriately firewalled to prevent access from outside.
Workstations are not firewalled from each other, and maybe proper
firewalling of a network can prevent exploits from outside (just as
wtih the server), but this assumes nothing gets through the firewall
via email exploits (viruses, trojans, etc.).

Do you really think that it's safe to have IIS running on a dozen or
more workstations, where it can easily accidentally revert to old,
unpatched states, and thus be vulnerable to any number of known
exploits?

And do you really believe that there aren't any significant security
flaws left in IIS? Given the ridiculous number of terrible bugs in
Internet Explorer that keep coming to light on a regular basis, I am
not optimistic about the safety of IIS.

Again, I simply see no reason why an SMTP server should be dependent
on installation of an HTTP server -- it makes no sense whatsoever.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #18

P: n/a
With that said, it is polite to mention it, especially if the people asking
may be from a different place (or they do not specify), just so they do not
think it will work everywhere....
--
MichKa [MS]
NLS Collation/Locale/Keyboard Development
Globalization Infrastructure and Font Technologies
Windows International Division

This posting is provided "AS IS" with
no warranties, and confers no rights.
"Steve Jorgensen" <no****@nospam.nospam> wrote in message
news:ae********************************@4ax.com...
On Fri, 9 Jul 2004 06:54:28 -0700, "Michael \(michka\) Kaplan [MS]"
<mi*****@online.microsoft.com> wrote:
Please note that there are several problems with Lyle's code for apps thatneed to support more than English, including the hard-coded path to OutlookExpress that assumes the English directory name for "Program Files" and theimproper use of Unicode conversion (converting the Unicode VBA strings to
"double Unicode") which causes the code to fail on CJK platforms.

There is a link to it from somewhere off of Tony's site at
http://www.granite.ab.ca/access/email.htm I believe.
I think it's rather a given that most example code that wasn't written to
handle multiple languages will need some adaptation to work that way. It
would be nice if our tools and APIs made it harder to write code that

doesn't work multi-lingually instead of hard to write code that does work
multi-lingually.

Nov 13 '05 #19

P: n/a
"David W. Fenton" <dX********@bway.net.invalid> wrote:
Do you really think that it's safe to have IIS running on a dozen or
more workstations, where it can easily accidentally revert to old,
unpatched states, and thus be vulnerable to any number of known
exploits?
Ah, gotcha. I didn't realize in what context you made that statement. I definitely
agree that you wouldn't want unneeded software/services running on systems.
And do you really believe that there aren't any significant security
flaws left in IIS? Given the ridiculous number of terrible bugs in
Internet Explorer that keep coming to light on a regular basis, I am
not optimistic about the safety of IIS.
Actually it might be more secure. It does a lot of things but I suspect from a
sheer line of code viewpoint IE has more code.
Again, I simply see no reason why an SMTP server should be dependent
on installation of an HTTP server -- it makes no sense whatsoever.


Agreed.

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
Nov 13 '05 #20

This discussion thread is closed

Replies have been disabled for this discussion.