473,503 Members | 2,107 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

simple email from access

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
19 2755
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
Lyle Fairfield just posted code that sends mail through Outlook
Express. Check the last few days of postings.
Nov 13 '05 #3
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
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
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
"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
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
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
"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
"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
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
"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
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
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
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
"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
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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1716
by: Dynamo | last post by:
Hi I have used the following script within a simple form email to prevent the form being used from an external url. <?php $referer = $_SERVER; // Get the URL of this page $myurl=...
1
2022
by: Howie | last post by:
Hi, i need a simple multiuser access to a file for parameters like increment numbers. The numbers are needed for order-numbers etc. They should be incremented by every programm (client) on an...
14
3082
by: alwayshouston | last post by:
Hi All! I am working on this very small database and I am confused in the designing a simple form. I only have three tables in the database. First Table: tblExpense Columns: ExpenseID ;...
3
1383
by: Unknown | last post by:
Hello i am new to C# and am having trouble with variable access.. What I am doing is just making a timer, and within the tick event I want a variable to increase a number.. for example tick...
4
2978
by: learnfpga | last post by:
I am trying to write a simple code for bit maniipulation and to start with wrote a little code to read the port A of a microcontroller MPC8xx. Its running on VxWorks. Anyways thats probably...
1
11956
by: Bart Van der Donck | last post by:
Hello, In my application, I'm having a directory with a bunch of .eml files. It was my intention to read out with PHP this directory, make a list of it and show them as .eml links in the...
3
1412
by: mturner64 | last post by:
I'm working on a simple web app to send email. Below is my code: Imports System.Net.Mail Partial Class _Default Inherits System.Web.UI.Page Protected Sub SubmitButton_Click(ByVal...
6
1787
by: migi | last post by:
Hi! I'm newbie with ASP and I have a simple task to do. I should send email using IIS. So I created html-file, which calls asp.page: <html> <form action="test.asp" method="POST"> <input...
3
1628
by: civettina | last post by:
Hi, I'm trying to send an email to' sample@sample.com' when a new row on my table contactform_con is inserted. Basically, when a person fills out the contact form (contactform_con) I want one...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7353
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7011
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5596
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4689
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3170
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
401
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.