PC Review


Reply
Thread Tools Rate Thread

Specify SMTP account when sending email through Outlook

 
 
=?Utf-8?B?T25kaW5l?=
Guest
Posts: n/a
 
      11th Sep 2006
Hi

I was wondering if it is possible to specify an SMTP account/service when
automating mail through Outlook using Access 2000. Most mail will be sent
via the default Microsoft Exchange server, but there are certain emails which
need to be routed through internet mail. I am using the standard code:

Function SendMessage(stAddr As String, stSubj As String, stBody As String,
Optional stCC As String, Optional stBCC As String, Optional AttachmentPath As
String) As Boolean

Set objOutlook = CreateObject("Outlook.Application")

Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

With objOutlookMsg

Set objOutlookRecip = .Recipients.Add(stRec)
objOutlookRecip.type = olTo

Set objOutlookAttach = .Attachments.Add(stPath)

......(etc)
.Send
End with

I can't see any place to specify the SMTP server - any ideas?

Many thanks.



 
Reply With Quote
 
 
 
 
=?Utf-8?B?UmFscGg=?=
Guest
Posts: n/a
 
      12th Sep 2006
Try using CDO. Something like

Dim imsg as CDO.Message
Dim iConf as CDO.Configuration
Dim flds as ADODB.Fields

Set iConf=imsg.configuration

Set Flds = iConf.Fields
Flds(cdoURLProxyServer) = "something.server.com:8080"
Flds(cdoURLProxyBypass) = "<local>"
Flds(cdoURLGetLatestVersion) = True
Flds(cdoSendUsingMethod) = cdoSendUsingPort
Flds(cdoSMTPServer) = "mymail"
Flds.Update

With iMsg
Set .Configuration = iConf
.CreateMHTMLBody (eAddress), cdoSuppressNone
.To ="(E-Mail Removed)"
.From = "eFrom"
.Subject = "some subject"
.Send
End With

"Ondine" wrote:

> Hi
>
> I was wondering if it is possible to specify an SMTP account/service when
> automating mail through Outlook using Access 2000. Most mail will be sent
> via the default Microsoft Exchange server, but there are certain emails which
> need to be routed through internet mail. I am using the standard code:
>
> Function SendMessage(stAddr As String, stSubj As String, stBody As String,
> Optional stCC As String, Optional stBCC As String, Optional AttachmentPath As
> String) As Boolean
>
> Set objOutlook = CreateObject("Outlook.Application")
>
> Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
>
> With objOutlookMsg
>
> Set objOutlookRecip = .Recipients.Add(stRec)
> objOutlookRecip.type = olTo
>
> Set objOutlookAttach = .Attachments.Add(stPath)
>
> ......(etc)
> .Send
> End with
>
> I can't see any place to specify the SMTP server - any ideas?
>
> Many thanks.
>
>
>

 
Reply With Quote
 
 
 
 
=?Utf-8?B?T25kaW5l?=
Guest
Posts: n/a
 
      12th Sep 2006
Thanks for the tip. I know very little about CDO and so will need to do some
research. Will this work with Exhange and Outlook 98?

Many thanks.

Ondine.


"Ralph" wrote:

> Try using CDO. Something like
>
> Dim imsg as CDO.Message
> Dim iConf as CDO.Configuration
> Dim flds as ADODB.Fields
>
> Set iConf=imsg.configuration
>
> Set Flds = iConf.Fields
> Flds(cdoURLProxyServer) = "something.server.com:8080"
> Flds(cdoURLProxyBypass) = "<local>"
> Flds(cdoURLGetLatestVersion) = True
> Flds(cdoSendUsingMethod) = cdoSendUsingPort
> Flds(cdoSMTPServer) = "mymail"
> Flds.Update
>
> With iMsg
> Set .Configuration = iConf
> .CreateMHTMLBody (eAddress), cdoSuppressNone
> .To ="(E-Mail Removed)"
> .From = "eFrom"
> .Subject = "some subject"
> .Send
> End With
>
> "Ondine" wrote:
>
> > Hi
> >
> > I was wondering if it is possible to specify an SMTP account/service when
> > automating mail through Outlook using Access 2000. Most mail will be sent
> > via the default Microsoft Exchange server, but there are certain emails which
> > need to be routed through internet mail. I am using the standard code:
> >
> > Function SendMessage(stAddr As String, stSubj As String, stBody As String,
> > Optional stCC As String, Optional stBCC As String, Optional AttachmentPath As
> > String) As Boolean
> >
> > Set objOutlook = CreateObject("Outlook.Application")
> >
> > Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
> >
> > With objOutlookMsg
> >
> > Set objOutlookRecip = .Recipients.Add(stRec)
> > objOutlookRecip.type = olTo
> >
> > Set objOutlookAttach = .Attachments.Add(stPath)
> >
> > ......(etc)
> > .Send
> > End with
> >
> > I can't see any place to specify the SMTP server - any ideas?
> >
> > Many thanks.
> >
> >
> >

 
Reply With Quote
 
Ondine
Guest
Posts: n/a
 
      13th Sep 2006
Further to my last post, just to let you know I have set this up and it
works a dream. I can see that it will bypass Outlook and Exchange,
which is very useful.

Thanks very much for your help


Ondine



Ralph wrote:
> Try using CDO. Something like
>
> Dim imsg as CDO.Message
> Dim iConf as CDO.Configuration
> Dim flds as ADODB.Fields
>
> Set iConf=imsg.configuration
>
> Set Flds = iConf.Fields
> Flds(cdoURLProxyServer) = "something.server.com:8080"
> Flds(cdoURLProxyBypass) = "<local>"
> Flds(cdoURLGetLatestVersion) = True
> Flds(cdoSendUsingMethod) = cdoSendUsingPort
> Flds(cdoSMTPServer) = "mymail"
> Flds.Update
>
> With iMsg
> Set .Configuration = iConf
> .CreateMHTMLBody (eAddress), cdoSuppressNone
> .To ="(E-Mail Removed)"
> .From = "eFrom"
> .Subject = "some subject"
> .Send
> End With
>
> "Ondine" wrote:
>
> > Hi
> >
> > I was wondering if it is possible to specify an SMTP account/service when
> > automating mail through Outlook using Access 2000. Most mail will be sent
> > via the default Microsoft Exchange server, but there are certain emails which
> > need to be routed through internet mail. I am using the standard code:
> >
> > Function SendMessage(stAddr As String, stSubj As String, stBody As String,
> > Optional stCC As String, Optional stBCC As String, Optional AttachmentPath As
> > String) As Boolean
> >
> > Set objOutlook = CreateObject("Outlook.Application")
> >
> > Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
> >
> > With objOutlookMsg
> >
> > Set objOutlookRecip = .Recipients.Add(stRec)
> > objOutlookRecip.type = olTo
> >
> > Set objOutlookAttach = .Attachments.Add(stPath)
> >
> > ......(etc)
> > .Send
> > End with
> >
> > I can't see any place to specify the SMTP server - any ideas?
> >
> > Many thanks.
> >
> >
> >


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem sending mail - SMTP or not SMTP! RW534 Windows Vista Mail 6 7th Jan 2008 12:29 AM
Outlook needs sending rule that lets you specify email account =?Utf-8?B?RGF2ZW1hYzE=?= Microsoft Outlook Contacts 14 13th Oct 2006 06:57 PM
how do I specify which email account to use when sending an emai. =?Utf-8?B?anVsaWV0?= Microsoft Outlook Discussion 4 2nd Mar 2006 11:38 AM
Specify which account to use for sending an email? =?Utf-8?B?RnJlZGg=?= Microsoft Outlook Discussion 1 15th Nov 2004 08:34 PM
How to specify which email account to use to send an email message (outlook 2k)? Andrew Microsoft Outlook 13 14th Jun 2004 06:37 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:14 PM.