CBrine
11-29-2006, 07:19 AM
I got this code from someone on this board, can't remeber who I recieved it from. It works great, but I haven't used it for any business application, since it looks like it bounces the mail I sent through the microsoft SMTP. Something outside of my scope of control. I can change it to take a login to our SMTP site, but that would require me to add my username and password to the code, which I don't want to do.
I've found a vb DLL class that does something similiar, where it sends the SMTP mail without a password. I want to use that, but my concern is that since it doesn't require a user/password that it may also be bouncing off an outside SMTP server.
My question is, If my server requires a user/password, is it possible that the dll could bypass this using a different technique?(It mentions encapsulating it using WinSock) Or if it's not using the user/password, then it must be bouncing through another STMP server.
Any help is appreciated.
Sub Mail_Small_Text_CDO()
Dim iMsg As CDO.Message
Dim iConf As CDO.Configuration
Dim flds As Object
Dim strbody As String
' Dim Flds As Variant
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
iConf.Load -1 ' CDO Source Defaults
Set flds = iConf.Fields
With flds
'.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "111.111.111.111"
'.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
'.Update
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "111.111.111.111"
.Item(cdoSMTPAuthenticate) = 1
.Item(cdoSendUserName) = "username"
.Item(cdoSendPassword) = "password"
.Update
End With
strbody = "Hey There," & vbNewLine & vbNewLine & _
"Test 1" & vbNewLine & _
"Test 2" & vbNewLine & _
"Test 3" & vbNewLine & _
"Test 4"
With iMsg
Set .Configuration = iConf
.To = "WhoEver@where.com"
.CC = ""
.BCC = ""
.From = """ME"" <me@where.com>"
.Subject = "Important message"
.TextBody = strbody
.Send
End With
Set iMsg = Nothing
Set iConf = Nothing
End Sub
Thanks
Cal
PS- I've cross posted this at
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_22076337.html
since I'm not sure the expertise is here to answer this one.
I've found a vb DLL class that does something similiar, where it sends the SMTP mail without a password. I want to use that, but my concern is that since it doesn't require a user/password that it may also be bouncing off an outside SMTP server.
My question is, If my server requires a user/password, is it possible that the dll could bypass this using a different technique?(It mentions encapsulating it using WinSock) Or if it's not using the user/password, then it must be bouncing through another STMP server.
Any help is appreciated.
Sub Mail_Small_Text_CDO()
Dim iMsg As CDO.Message
Dim iConf As CDO.Configuration
Dim flds As Object
Dim strbody As String
' Dim Flds As Variant
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
iConf.Load -1 ' CDO Source Defaults
Set flds = iConf.Fields
With flds
'.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "111.111.111.111"
'.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
'.Update
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "111.111.111.111"
.Item(cdoSMTPAuthenticate) = 1
.Item(cdoSendUserName) = "username"
.Item(cdoSendPassword) = "password"
.Update
End With
strbody = "Hey There," & vbNewLine & vbNewLine & _
"Test 1" & vbNewLine & _
"Test 2" & vbNewLine & _
"Test 3" & vbNewLine & _
"Test 4"
With iMsg
Set .Configuration = iConf
.To = "WhoEver@where.com"
.CC = ""
.BCC = ""
.From = """ME"" <me@where.com>"
.Subject = "Important message"
.TextBody = strbody
.Send
End With
Set iMsg = Nothing
Set iConf = Nothing
End Sub
Thanks
Cal
PS- I've cross posted this at
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_22076337.html
since I'm not sure the expertise is here to answer this one.