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

Send an email directly through Exchange

P: n/a
If there is no email client on the XP workstation that my DB is on, is it
possible for Access to talk directly with Exchange Server to send an email?

I am sure you might think, what's the problem with simply installing
Outlook. Well I guess I am looking for the "elegant" solution :O)

Thanks

Paul
Jul 5 '06 #1
Share this Question
Share on Google+
9 Replies


P: n/a
Hi Paul,

The following KB article might help:

http://support.microsoft.com/?kbid=153311

Cheers - David
Paul H wrote:
If there is no email client on the XP workstation that my DB is on, is it
possible for Access to talk directly with Exchange Server to send an email?

I am sure you might think, what's the problem with simply installing
Outlook. Well I guess I am looking for the "elegant" solution :O)

Thanks

Paul
Jul 5 '06 #2

P: n/a

Paul H wrote:
Well I guess I am looking for the "elegant" solution :O)
hour of pain working this one out! just substitute the [] fields and
include the Miscrosoft CDO library - no outlook profiles required:

Sub SendHTMLMail(strTo As String, strSubject As String, strBody As
String)
'================================================= ===
'Bill Coleman
'20th April 06
'Sends email HTML email directly via exchange server, w/o outlook
'================================================= ===

Dim iCfg As CDO.Configuration
Dim iMsg As CDO.Message

Set iCfg = New CDO.Configuration

With iCfg
.Fields(cdoSMTPServer) = "[EXCHANGE SERVER NAME]"
.Fields(cdoSMTPServerPort) = 25 ' typically
.Fields(cdoSendUsingMethod) = cdoSendUsingPort
.Fields(cdoSMTPConnectionTimeout) = 200
.Fields.Update
End With

Set iMsg = New CDO.Message
With iMsg
Set .Configuration = iCfg
.From = "[Name Of Sender]"
.Sender = "[Me@Whatever.com]"
.ReplyTo = "[Me@Whatever.com]"
.Subject = strSubject
.HTMLBody = strBody
.To = strTo
.Send
End With

Set iMsg = Nothing
Set iCfg = Nothing

End Sub

Jul 5 '06 #3

P: n/a
this article explains how it works rather well:
http://www.imibo.com/delphi/mapiorcdo.html

You can use the MAPI directly if you are feeling brave, but it's far
more complicated then needs be when you have the CDO wrapper - also
most reference examples using MAPI require that there be an outlook
profile on the PC, bringing you back to square one, needing outlook.
But the code I gave (a twist on somthing from Lyle, I think) talks
directly with no profile. That way outlook isnt envoked and you dont
have to suffer those security warnings (outlook 2003+).

Jul 5 '06 #4

P: n/a

"BillCo" <co**********@gmail.comwrote in message
news:11*********************@a14g2000cwb.googlegro ups.com...
>
Paul H wrote:
>Well I guess I am looking for the "elegant" solution :O)

hour of pain working this one out! just substitute the [] fields and
include the Miscrosoft CDO library - no outlook profiles required:

Sub SendHTMLMail(strTo As String, strSubject As String, strBody As
String)
'================================================= ===
'Bill Coleman
'20th April 06
'Sends email HTML email directly via exchange server, w/o outlook
'================================================= ===

Dim iCfg As CDO.Configuration
Dim iMsg As CDO.Message

Set iCfg = New CDO.Configuration

With iCfg
.Fields(cdoSMTPServer) = "[EXCHANGE SERVER NAME]"
.Fields(cdoSMTPServerPort) = 25 ' typically
.Fields(cdoSendUsingMethod) = cdoSendUsingPort
.Fields(cdoSMTPConnectionTimeout) = 200
.Fields.Update
End With

Set iMsg = New CDO.Message
With iMsg
Set .Configuration = iCfg
.From = "[Name Of Sender]"
.Sender = "[Me@Whatever.com]"
.ReplyTo = "[Me@Whatever.com]"
.Subject = strSubject
.HTMLBody = strBody
.To = strTo
.Send
End With

Set iMsg = Nothing
Set iCfg = Nothing

End Sub
Many thanks for that..I feel your pain ;o)

How can check for the existence of the Exchange server? This is so that the
database can "choose" to use exchange instead of Outlook if the PC is
connected to an Exchange server.

My development PC does not connect to an Exchange server.

Thanks,

Paul
Jul 6 '06 #5

P: n/a
What is interesting is that with suitable amendment this works with script
as well.
--

Terry Kreft
"Paul H" <no****@nospam.comwrote in message
news:Is******************************@eclipse.net. uk...
>
"BillCo" <co**********@gmail.comwrote in message
news:11*********************@a14g2000cwb.googlegro ups.com...

Paul H wrote:
Well I guess I am looking for the "elegant" solution :O)
hour of pain working this one out! just substitute the [] fields and
include the Miscrosoft CDO library - no outlook profiles required:

Sub SendHTMLMail(strTo As String, strSubject As String, strBody As
String)
'================================================= ===
'Bill Coleman
'20th April 06
'Sends email HTML email directly via exchange server, w/o outlook
'================================================= ===

Dim iCfg As CDO.Configuration
Dim iMsg As CDO.Message

Set iCfg = New CDO.Configuration

With iCfg
.Fields(cdoSMTPServer) = "[EXCHANGE SERVER NAME]"
.Fields(cdoSMTPServerPort) = 25 ' typically
.Fields(cdoSendUsingMethod) = cdoSendUsingPort
.Fields(cdoSMTPConnectionTimeout) = 200
.Fields.Update
End With

Set iMsg = New CDO.Message
With iMsg
Set .Configuration = iCfg
.From = "[Name Of Sender]"
.Sender = "[Me@Whatever.com]"
.ReplyTo = "[Me@Whatever.com]"
.Subject = strSubject
.HTMLBody = strBody
.To = strTo
.Send
End With

Set iMsg = Nothing
Set iCfg = Nothing

End Sub

Many thanks for that..I feel your pain ;o)

How can check for the existence of the Exchange server? This is so that
the
database can "choose" to use exchange instead of Outlook if the PC is
connected to an Exchange server.

My development PC does not connect to an Exchange server.

Thanks,

Paul


Jul 6 '06 #6

P: n/a
Just a quickie to say thanks Bill, it worked perfectly and no Terry, I am
not a script kiddie!

Paul
Jul 12 '06 #7

P: n/a
I didn't imply that you were.

Having said that and with all due distaste for scrip kiddies out of the way,
there are occasions where scripting is the best tool for the job.

There was an occasion just last year where this code would have been useful
to a colleague of mine who needed to be able to e-mail alerts from a
script, also there is a customer of mine who changed server, didn't install
SMTP on the new server and then wondered why e-mail alerts from a DTS
package stopped working. I suspect that a VBScript component added to the
package with the code posted in this script could well have sorted their
problem for them.

--

Terry Kreft
"Paul H" <no****@nospam.comwrote in message
news:ba********************@eclipse.net.uk...
Just a quickie to say thanks Bill, it worked perfectly and no Terry, I am
not a script kiddie!

Paul


Jul 12 '06 #8

P: n/a
>I didn't imply that you were.
My apologies, I misunderstood you and got paranoid about being deemed
"unclean" by the group ;o)

My mistake,

Regards,

Paul


Jul 13 '06 #9

P: n/a
It's all too easy to misunderstand posts.

I reckon that lack of body language has been the cause of more heated
discussions than most anything else in NGs.
--

Terry Kreft
"Paul H" <no****@nospam.comwrote in message
news:zd********************@eclipse.net.uk...
>
I didn't imply that you were.

My apologies, I misunderstood you and got paranoid about being deemed
"unclean" by the group ;o)

My mistake,

Regards,

Paul


Jul 13 '06 #10

This discussion thread is closed

Replies have been disabled for this discussion.