TDM
Fri Oct 24 12:29:35 CDT 2003
Bryan,
I have a mail script that I use and it seems to me that it works
with authentication but I have not testes/used it lately. Here is
the function from my script that actually sends the mail, give it
a wack and see if it helps. I have no way of testing it right now.
Change the network stuff and see where it gets you.
TDM
Function sendMail(sSubject, sRecipient, sMessageBody, sAttachent)
'This function actaully sends the mail. Various different things
'you can do, see commented descriptions.
Dim iMsg 'as Object
Dim iConf 'as Object
Dim Flds 'as Collection
Const cdoSendUsingMethod =
"
http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSMTPServerName =
"
http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdoSendUserName =
"
http://schemas.microsoft.com/cdo/configuration/sendusername"
Const cdoSendPassword =
"
http://schemas.microsoft.com/cdo/configuration/sendpassword"
Const cdoURLProxyServer =
"
http://schemas.microsoft.com/cdo/configuration/urlproxyserver"
Const cdoURLProxyBypass =
"
http://schemas.microsoft.com/cdo/configuration/urlproxybypass"
Const cdoSMTPAuthenticate =
"
http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
Const cdoURLGetLatestVersion =
"
http://schemas.microsoft.com/cdo/configuration/urlgetlatestversion"
Const cdoSMTPConnectionTimeout =
"
http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServerName) = "mail.domain.com"
.Item(cdoSMTPConnectionTimeout) = 10 ' quick timeout
.Item(cdoSMTPAuthenticate) = cdoBasic
'lines below only if your SMTP gateway requires authentication, most do
.Item(cdoSendUserName) = "username"
.Item(cdoSendPassword) = "password"
'lines below only if sending through a proxy server, not likely Harold but
just in case
'.Item(cdoURLProxyServer) = "web-proxy:80"
'.Item(cdoURLProxyBypass) = "<local>"
'.Item(cdoURLGetLatestVersion) = True
.Update
End With
With iMsg
Set .Configuration = iConf
.To = """Recip A"" <" & sRecipient & ">"
.From = """From MyName"" <myname@mail.com>"
.Subject = sSubject
.TextBody = sMessageBody
'lines below only if you want to insert a web page.
'.CreateMHTMLBody "
http://www.microsoft.com"
If sAttachment <> "" Then
.AddAttachment sAttachment
End If
.Send
End With
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
End Function
"Bryan Kramer" <bryanekramer@msn.com> wrote in message
news:03e101c399a9$adcdbc10$a401280a@phx.gbl...
> I am trying to send an email from a VBscript, outbound
> thru an SMTP server. My SMTP wants logon validation and I
> have not found how to do that yet! If I use MAPI and
> reference my 'Profile' which contains the login
> credentials then Outlook cries foul thinking my script is
> a virus trying to hijak my email account!
>
> How do I pass credentials from the script to send the
> email w/o getting frisked by outlook's security?
>