Two methods for sending email?

Christine Pearc

Christine
Local time
Today, 17:06
Joined
May 13, 2004
Messages
111
We use Outlook for our email. I have been using the DoCmd.SendObject to send emails automatically from Access. However, recently I've seen the following method:

Dim myoutlook As Outlook.Application
'create outlook
Set myoutlook = CreateObject("Outlook.Application")
Set mymsg = myoutlook.CreateItem(olMailItem)
...etc.

What is the benefit of the above example over the much simpler SendObject method? (BTW, we are using XP. Our MIS department is currently in the process of altering the DLL to get around the latest Microsoft security patch, i.e. "Another programme is attempting to send an email...")

Thank you,
Christine
 
Thank you for that, Kodo. Unfortunately, your recommended method won't work as we don't use an STMP thingy. And besides, the code is WAY beyond my beginner skill level - I don't feel comfortable using code that I don't understand. I, will, however, keep the code handy for when I grow up. :)

Could you or someone else explain the pros/cons of the two methods in my original post?

Cheers,
Christine
 
here are a few basics that come o mind right away:

Using Outlook-
Pro:
Saved in sent items
Can use outlook objects

Con:
Must deal with security features
Must have outlook installed (licensing)

Using IIS and SMTP-
Pro:
Avoids requirement to have outlook installed
Avoids security prompts
Uses less application resources(i.e. it doesn't need to load outlook to memory to send the mail)
Can dynamically alter "From:" value. (In outlook, you send through a specified account. With a relay, you can specify anything you want. It doesn't even have to exist. This is how spammers spoof email addresses.)
Requires only one installation of IIS

Con:
Must secure it properly
Does not save to sent items
Doesn't recieve mail, but that really isn't an issue because if you put a valid email address in From: then any replies will be sent to that email address and not the smtp relay.
 
Thanks, however, perhaps I'm not being clear. My question isn't about which system to use, since Outlook is the only email system we use and, perhaps more importantly, I don't even know the what IIS and SMTP are. Rather, I was curious why some people send email using the code...

DoCmd.SendObject

...versus others who use...

Dim myoutlook As Outlook.Application
Set myoutlook = CreateObject("Outlook.Application")
Set mymsg = myoutlook.CreateItem(olMailItem)
...etc.

DoCmd.SendObject has one line of code and is simple, whereas the 2nd mention has lots of code. It is the pros/cons of these two ways of coding the email that I'm after.

Hope I've explained this better!

Christine
 
Last edited:

Users who are viewing this thread

Back
Top Bottom