Successful Emailing from an Access program without using Outlook.

G

genojoe

I tried doing email using Outlook. I had some success but not without pain.
For an earlier question on this subject, you can seach this discussion group
for my name.

What I learned lead me to:

http://groups.google.co.uk/group/mi...b2f2a?lnk=st&q=&rnum=1&hl=en#34ee51354bab2f2a

For more information on this subject go to:
http://search.microsoft.com/advancedsearch.aspx?mkt=en-US&setlang=en-US
and search for CDONTS one article that I found is:
http://support.microsoft.com/kb/324649

I did not read it because after successfully testing the code shown below, I
had no need to further pursue the subject.

My resulting code that I could successfully execute is:

Public Sub proSendEmail()
Dim CDOMessage As Object
Dim CDOConf As Object
Dim CDOFlds As Object
Set CDOConf = CreateObject("CDO.Configuration")
Set CDOFlds = CDOConf.Fields
CDOFlds("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
CDOFlds("http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"smtp-server.neo.rr.com"
CDOFlds("http://schemas.microsoft.com/cdo/configuration/smtpserverport")
= 25
CDOFlds.Update
Set CDOMessage = CreateObject("CDO.Message")
Set CDOMessage.Configuration = CDOConf
With CDOMessage
.From = "(e-mail address removed)"
.To = "(e-mail address removed)"
.To = "(e-mail address removed)"
.Subject = "Test Message"
.TextBody = "This is a test"
.AddAttachment "C:\Temp\Autumn Hills.SNP"
.AddAttachment "C:\Temp\Calcutta.SNP"
.Send
End With
End Sub

This code sends two attachments to two people. No references are needed to
make this code work.

The only drawback (that I know of) to using this method instead of Outlook
is that you do not end up with a copy of message in your Sent folder of
Outlook.

If anyone wants to expand upon the information herein, add it to this topic
as a comment.
 
G

genojoe

.To = "(e-mail address removed)"
.To = "(e-mail address removed)"

should be

.To = "(e-mail address removed); (e-mail address removed)"

When I first tested, I thought it worked. Upon further testing, discovered
the problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top